If you really want to stress test time handling code, try to get it to accept Feburary 29, 1900 and Feburary 29, 2000. The first doesn't exist but the second does. But really, with regards to time use whatever library came with you programming language.
That will stress it a bit, but to really torture it, see if it accepts 2012 June 30 23:59:60
Falsehoods Programmers believe about Time
41–50 of 222 posts
Re: Falsehoods Programmers believe about Time
#4239. The next day after 3 Sep 1752 is 4 Sep 1752.
Re: Falsehoods Programmers believe about Time
#43About #7: doesn't a month always end in the same year it started?
The way you're thinking about it, yes -- but the passage of a month may take you from December the [mumbleth] to January the [mumbleth], which are in different years. For some strange reason, code in the wild doesn't always account for that, so the due date for an item may well be eleven months before the request was entered.
Re: Falsehoods Programmers believe about Time
#44Adobe managed to build a pretty shitty Date object for ActionScript that takes days as a 1-indexed parameter, but months as 0-indexed. Hopefully ActionScript is not used in banking [1]
[1] http://help.adobe.com/en_US/FlashPlatform/reference/actionsc...
Re: Falsehoods Programmers believe about Time
#45Re: Falsehoods Programmers believe about Time
#46Earlier quoted context omitted.
36. 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.
39. 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.
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.
Re: Falsehoods Programmers believe about Time
#47Re: Falsehoods Programmers believe about Time
#48Re: Falsehoods Programmers believe about Time
#49If only someone would come up with a standard time format, surely that would solve all issues... In all seriousness time-stamps are some of the most annoying things to compare ever.
Re: Falsehoods Programmers believe about Time
#50Earlier quoted context omitted.
> September 1752 had 19 days: 1, 2, 14, 15, ..., 29, 30. In the British Empire, anyway.
From which many modern reckonings of time descend, including the one used by all modern computer systems.
As for "all modern computer systems", Unix time is completely ignorant about anything except seconds.