7 ms·
35. Two timezones that differ, will differ by an integer number of hours.
by arohner 14y ago
35. Two timezones that differ, will differ by an integer number of hours.
- aardvark179 14y ago36. Two timezones that differ will differ by an integer number of half hours. 37. Okay, quarter hours. 38. Okay, seconds, but it will be a consistent difference if we ignore DST.
- bazzargh 14y ago39. If you create two date objects right beside each other, they'll represent the same time. (a fantastic Heisenbug generator) 40. You can wait for the clock to reach exactly HH:MM:SS by sampling once a second.
- eblume 14y agoI'm not sure this counts as a constructive comment, but an interesting anecdote anyway - an early coding partner of mine once wrote a procedure he expected to run once exactly every second by continuously polling the time in a while/do_nothing loop until exactly one second had passed. It took some convincing to get him to accept that try as he might, it was very unlikely that "==" was what he wanted there. The best part was that this was in Javascript (and obviously he was not using a timeout). The entire page would lock up while it waited for the second to elapse. He never even figured out the obvious usability concern because he was so confounded by the fact that the procedure wasn't getting called after a second had passed. Ok, to be fair, it was a freshman year programming class - not an unexpected or even unusual mistake. But it gave me a chuckle just now remembering it.
- gbog 14y agoIn the same vein I can bet I have seen at last 5 implementation of date diffing using string representation.
- mikeash 14y agoSomewhat related, but I've seen a lot of retry-with-a-timeout loops that will either throw a spurious timeout error or wait for a very long time if the system clock just happens to jump at the right time. Another amusing anecdote: I got an old PowerBook out of storage and booted it up. The battery had run flat, so the clock reset to 1970. Spotlight noticed this and decided it had to reindex the entire drive. At some point during all of this, NTP kicked in and reset the clock to the correct year. I wanted to see how long Spotlight would take to finish indexing, so I popped down the menu. The progress bar indicated that it was about halfway done, and based on how long it had taken so far, it estimated that only another 40 years would be required to finish!
- NoahSussman 14y ago#40 actually made me laugh out loud. Bitterly, but out loud :-)
- sethg 14y agoWhat has a non-integral number of seconds? I just found out today about Calcutta time, which until 1948 was GMT+05:30:21, but I didn’t realize it could be even worse than that.
- brazzy 14y agoYeah, that one even made it into the EXIF standard...
- JoshTriplett 14y agoN. The offsets between two time zones will remain constant. N+1. OK, historical oddities aside, the offsets between two time zones won't change in the future. N+2. Changes in the offsets between time zones will occur with plenty of advance notice. N+3. Daylight savings time happens at the same time every year. N+4. Daylight savings time happens at the same time in every time zone. N+5. Daylight savings time always adjusts by an hour. N+6. Months have either 28, 29, 30, or 31 days. N+7. The day of the month always advances contiguously from N to either N+1 or 1, with no discontinuities. Explanations: (N)-(N+2): There exist enough jurisdictions in the world that time zone changes occur often enough to require regular updates to the time zone database, more frequently than many distribution release schedules occur. (N+3)-(N+5): Jurisdictions change DST policies even more frequently than they change time zones. (N+6)-(N+7): September 1752 had 19 days: 1, 2, 14, 15, ..., 29, 30.
- brazzy 14y ago> September 1752 had 19 days: 1, 2, 14, 15, ..., 29, 30. In the British Empire, anyway.
- JoshTriplett 14y agoFrom which many modern reckonings of time descend, including the one used by all modern computer systems.
- brazzy 14y agoActually, almost no country outside the British Empire (and not even Scotland inside it) implemented the Gregorian reform at the same time. Britain was pretty late in doing so, too. As for "all modern computer systems", Unix time is completely ignorant about anything except seconds.
- fusiongyro 14y ago> Unix time is completely ignorant about anything except seconds. In hindsight, it seems like a brilliant decision.
- jimfl 14y agoThe day before Saturday is always Friday. http://www.nytimes.com/2011/12/30/world/asia/samoa-to-skip-friday-and-switch-time-zones.html http://www.nytimes.com/2011/12/30/world/asia/samoa-to-skip-f...
- benjaminRRR 14y agoThis was hilarious for people who had booked tickets on flights out on the 30th. Do you leave on the 29th or the 31st...? This was a real problem for the airlines and headache for a number of travellers.
- Muzza 14y agoHmm. I've written code which assumes that Monday is two days after Saturday and one day after Sunday.
- einhverfr 14y ago36: Continguous timezones are no more than an hour apart. (aka we don't need to test what happens to the avionics when you fly over the International Date Line)
- gregholmberg 14y agoIt's a recurring problem, too. These examples are twenty-two years apart. "Aircraft software can be serious business" http://www.defenseindustrydaily.com/f22-squadron-shot-down-by-the-international-date-line-03087/ http://www.defenseindustrydaily.com/f22-squadron-shot-down-b... "The [F22 Raptor IDL] post-incident report" http://it.slashdot.org/comments.pl?sid=224098&cid=18150134 http://it.slashdot.org/comments.pl?sid=224098&cid=181501... "[undetected software bug in the] Northrop F-20 Tigershark laser inertial navigation system" http://www.f20a.com/f20ins.htm http://www.f20a.com/f20ins.htm
- adavies42 14y ago17% of the world's population lives in a single .5 timezone (https://en.wikipedia.org/wiki/Indian_Standard_Time https://en.wikipedia.org/wiki/Indian_Standard_Time), so i'd hope that one's not too widespread....