Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Falsehood Programmer Beliefs about Time

I just went through Falsehood Programmer Beliefes about Time + number 2. Most of them fall into three groups:

  • Leap years / seconds
  • Nepal has UTC+0545
  • DST

But there are a couple I cannot find the answer to. Can somebody here help and tell me why the following statements are false?

  1. The system clock will never be set to a time that is in the distant past or the far future.
  2. Ok, but the duration of one minute on the system clock will be pretty close to the duration of one minute on most other clocks.

And from the crouwd-version:

  1. Non leap years will never contain a leap day.
  2. Unix time is completely ignorant about anything except seconds.
  3. Unix time is the number of seconds since Jan 1st 1970.
  4. The day before Saturday is always Friday
  5. [Two timezones that differ will differ by an integer number of] quarter hours.
  6. If you parse a date time, you can read the numbers character for character, without needing to backtrack
  7. But if you print a date time, you can write the numbers character for character, without needing to backtrack
  8. You will never have to parse a format like —12Z or P12Y34M56DT78H90M12.345S
  9. Years have 365 or 366 days.
  10. Time passes at the same speed on top of a mountain and at the bottom of a valley.
  11. The software will never run on a space ship that is orbiting a black hole.

My guess is that there is one (or at least only a few) categories/facts about datetime / timezone I completely forgot. What is it?

like image 475
Martin Thoma Avatar asked Oct 15 '25 16:10

Martin Thoma


1 Answers

The question appears pretty broad as written, but I can address the first two and a few of the others.

  1. The system clock will never be set to a time that is in the distant past or the far future.

This is sometimes done by developers for testing purposes. Someone writing an application might want to make sure that their app will still work past some Y2K-like barrier in the near future. While testing this, they shouldn't need to worry that their mouse driver will go kablooie because it wasn't configured to work well when January 1, 5010 comes a day after August 28, 2018, and it doesn't know what to do when it realizes that it doesn't have any log entries for the entirety of 5009.

  1. Ok, but the duration of one minute on the system clock will be pretty close to the duration of one minute on most other clocks.

A computer system might be on board a spaceship near a black hole and subject to its time dilation. If it needs to maintain a connection with a computer some distance away (e.g. via some future interstellar packet radio), it shouldn't barf out, give garbled output, or bluescreen because the system clocks get out of sync by a few hours or even more.

This can also be caused by a damaged or defective internal clock. Timing crystals, EPROM, and other components tend to be pretty robust and reliable, but they are manufactured goods that do have some tolerances and do fail on rare occasions.

Also, from your second list:

  1. Years have 365 or 366 days.

In some countries, including the UK, the year 1752 had 354 days due to the conversion from the Julian to the Gregorian calendar.

  1. The day before Saturday is always Friday

In 2011, Samoa switched time zones, skipping directly from Thursday to Saturday.

  1. Time passes at the same speed on top of a mountain and at the bottom of a valley.

  2. The software will never run on a space ship that is orbiting a black hole.

These are both references to the aforementioned time dilation.

There are really two principles here. One is relativity/time dilation, and the other is the fact that the calendar is NOT a simple static equation! It changes with the times due to political, social, and astronomical realities! Many of the other items also relate to the fact that the calendar may change in the future. It has changed before, so why wouldn't it ever change again?

There is also the matter of proposed timekeeping systems on other planets, such as Mars. Maybe we don't have computers running with them now, but maybe the software you are writing now will be installed on Martian-bound systems configured for Olympus Mons Time (hey, some people are still using Windows XP in 2018, what do you expect?).

like image 106
Robert Columbia Avatar answered Oct 18 '25 06:10

Robert Columbia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!