Live data from Hacker News

Falsehoods Programmers believe about Time

infiniteundo.com

11–20 of 222 posts

Re: Falsehoods Programmers believe about Time

#11
post #8

Who believes these things? February is always 28 days long? Any 24-hour period will always begin and end in the same day (or week, or month)? A week always begins and ends in the same month?

He's talking about test code. So if those test cases are missing, but the programmer thinks the tests are thorough, then it looks like the programmer believes those things (or forgot that they weren't true).

Re: Falsehoods Programmers believe about Time

#14
post #8

Who believes these things? February is always 28 days long? Any 24-hour period will always begin and end in the same day (or week, or month)? A week always begins and ends in the same month?

I thought about the same thing. I choose to read the title as "Falsehoods programmers seem to believe about time". Or "act as if they believe" in place of "seem to believe".

I can easily imagine somebody introducing a bug that relies on a 24 hour period ending in the same month as it began.

Re: Falsehoods Programmers believe about Time

#18
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.

Re: Falsehoods Programmers believe about Time

#19
post #4

Can someone explain #1? I suspect it has to do with crossing time zones?

Day light savings transition days. When you skip ahead, that day has 23 hours in it. When you fall back, it has 25.

Also, any other change to the system clock. NTP will either slew or step the system clock to keep it synchronized with the upstream time source. And the user can explicitly set the clock, as well. See also assumptions 9 and 10.
Post reply on HN