Live data from Hacker News

Falsehoods programmers believe about time

infiniteundo.com

41–50 of 212 posts

Re: Falsehoods programmers believe about time

#41

"Months have either 28, 29, 30, or 31 days." Ok, Im intrigued, are there months that don't? I assume it must be a country specific thing?

Adoption of the Gregorian calendar [1] resulted in a number of short months in a bunch of countries. Different but related, 46 BC, the year of adoption of the Julian calendar, had 15 months [2]. [1]: https://en.wikipedia.org/wiki/Adoption_of_the_Gregorian_cale... [2]: https://www.uh.edu/engines/epi2364.htm

That's what I thought. This list mixes "falsehoods" that nobody with a bit of common sense - even children - would believe, and pedantry that could be useful to 0.001% of developers. For most programs, Time starts in 1970.

IMO, this list is only good at... wasting time. Except for the multiple statements (that could be one or two) that point out that there's not such a thing like "identical clocks" and "same time on two clocks".

Re: Falsehoods programmers believe about time

#42

>Leap years occur every 4 years. Isn't leap year calculation one of the very first things you do in most programming tutorials/schools? I know that a lot of people don't know this, but most programmers should, r-r-r-right?

If you handle dates and times yourself on that level, prepare to be in a world of pain.

Handling time and dates correctly has a similar difficulty to writing your own cryptographic primitives: If you don't know exactly what you are doing you will shoot yourself (and potentially countless others) into the foot at one in point or another.

Re: Falsehoods programmers believe about time

#43

> A week (or a month) always begins and ends in the same year Okay, of course a week can begin in an year and end in the next, but how exactly would a month not begin and end in the same year?

I don't think they mean what you think they mean.

I think they mean that if someone says "remind me in a month" On December 3rd, the reminder would be next year.

I've never met a developer who believed that, but I've met plenty who would forget about the edge-case and write a buggy time-library. As is the case for most of these.

Re: Falsehoods programmers believe about time

#44
post #42

>Leap years occur every 4 years. Isn't leap year calculation one of the very first things you do in most programming tutorials/schools? I know that a lot of people don't know this, but most programmers should, r-r-r-right?

If you handle dates and times yourself on that level, prepare to be in a world of pain. Handling time and dates correctly has a similar difficulty to writing your own cryptographic primitives: If you don't know exactly what you are doing you will shoot yourself (and potentially countless others) into the foot at one in point or another.

See also the problems in the Excel datetime calculations that are now unfixable because a fix would break many existing problems.

e.g. https://en.wikipedia.org/wiki/Leap_year_problem

Re: Falsehoods programmers believe about time

#46
post #10

> There are always 24 hours in a day. Is this referring to leap seconds or what do the mean?

When the timezone changes for daylight savings time, you either lose or gain 1 hour in that day (or whatever your local equivalent is).

Makes sense, thanks!

Re: Falsehoods programmers believe about time

#47
post #5
post #4

Earlier quoted context omitted.

It isn't "falsehoods all programmers believe..." it's "falsehoods that [some|lots|many|inexperienced] programmers believe..." Unless you work all day on time-related software, you'll probably never encounter most of these quirks. Humans don't write in BNF. We expect, rightly or wrongly, for other humans to use Postel's law to interpret what we mean.

But the point is that programmers are less likely to believe these things than ordinary people are.

But they’re more likely to be impacted.

Re: Falsehoods programmers believe about time

#48
post #20

Does anyone actually believe this? Even the most inexperienced developers I’ve worked with are well aware that time, and timezones in particular, are really difficult. I’ve yet to meet anyone that has suggested using anything other than a battle-hardened standard library for time.

I once worked for a company, where the gps platform had multiple time related problems. This list pretty much sums it all up.

Re: Falsehoods programmers believe about time

#49
> Britain uses GMT.

Which Outlook in particular seems to get direly wrong. I have lost count of the number of times I have been sent an email from someone using Outlook containing a supposed calendar event in summer which declares that it is at a particular time GMT. It's wrong, and if I were to turn up at the time it stated, I would be an hour late.

Re: Falsehoods programmers believe about time

#50

Earlier quoted context omitted.

Adoption of the Gregorian calendar [1] resulted in a number of short months in a bunch of countries. Different but related, 46 BC, the year of adoption of the Julian calendar, had 15 months [2]. [1]: https://en.wikipedia.org/wiki/Adoption_of_the_Gregorian_cale... [2]: https://www.uh.edu/engines/epi2364.htm

That's what I thought. This list mixes "falsehoods" that nobody with a bit of common sense - even children - would believe, and pedantry that could be useful to 0.001% of developers. For most programs, Time starts in 1970. IMO, this list is only good at... wasting time. Except for the multiple statements (that could be one or two) that point out that there's not such a thing like "identical clocks" and "same time on…

So "most" programs can ignore birth dates of people older than 52? I don't think so.
Post reply on HN