4 ms·
Bugs in time-based code are great. The most amusing example I've seen was an intermittently-failing automated test case which, I discovered after careful scruti
by qntm 16y ago
Bugs in time-based code are great. The most amusing example I've seen was an intermittently-failing automated test case which, I discovered after careful scrutiny of the results database, failed only on Sundays.
There's also the classic time zone unit test "convert this Europe/London timestamp to America/New_York time, verify that it is now 5 hours behind", which, due to Bush's pointless Daylight Saving shift, now fails for two weeks twice a year. Of course, two weeks is just short enough and the bug is just inconsequential enough (the time zone code itself is working correctly, after all, it's the test case that's broken) that the regression goes away before anybody fixes it.
I can only imagine how much otherwise robust code flips its lid when presented with, for example, a leap second. It's the number one argument for the use of mock objects in testing.
- yahelc 16y ago"Bush's pointless Daylight Saving shift" ? Staunch Democrat though I may be, how is the Daylight Savings shift Bush's fault?
- xinsight 16y agoOne of the last things he did in office was move it 2 weeks earlier. Canada followed along and now North America is out of sync with most other countries.
- burgerbrain 16y agoSo just use UTC and get on with your life?
- xinsight 16y agoI'd prefer to just get rid of DST.
- mooism2 16y agoNorth America was out of sync with Europe before this change. North America used to put the clocks forward on the first Sunday of April; now that happens on the second Sunday of March. Europe standardised on the last Sunday of March during the 90s.