Live data from Hacker News

Falsehoods programmers believe about time

infiniteundo.com

21–30 of 212 posts

Re: Falsehoods programmers believe about time

#21

"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?

I'd expect in a lunar calendar system? (where 12 lunar months are to short to fill a year, and I think some of them fix this by inserting an extra half-month)

But I wish this list came with examples, and if it really means a different calendar system it's IMHO not as interesting, because it's IMHO fairly obvious that different calendar systems follow different rules. Or maybe during the switch to Gregorian calendar? That you'd at least encounter with dates for things long ago - although that transition is very "here be dragons" and very local.

Re: Falsehoods programmers believe about time

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

> Does anyone actually believe this?

Does any programmer believe ALL these falsehoods? Not very likely.

Do most programmers believe AT LEAST ONE of these falsehoods? Likely.

> I’ve yet to meet anyone that has suggested using anything other than a battle-hardened standard library for time.

Many stdlibs still don't account for the most edge of corner cases -- or make it very easy to screw up anyway.

Re: Falsehoods programmers believe about time

#24

I've worked with calendar applications and todo managers, alarms, recurring events and all that. Our timekeeping mechanics are incredibly complex. 24hs before 15:00 is USUALLY 15:00. But in some timezones, it can be (about once a year): 14:00, 16:00 or 14:59:59. It's currently Monday 11:02 here, but it's likely still Sunday in some parts of the world (or is it already Tuesday somewhere? Not sure which is right). So,…

14h CET is 14h CET each and every time. It is just that we automatically reschedule it to 14h CEST when summertime is in use.

Also it is in use for 7 months not 6 months...

Re: Falsehoods programmers believe about time

#26

"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

Re: Falsehoods programmers believe about time

#27

"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?

If I am not wrong this holds true for the switch from Julian calendar to the Gregorian one. Some months were shortened to be synchronised with the new system. And if I am not mistaken Jewish and Arabs do not use the same systems we use for months and years

Re: Falsehoods programmers believe about time

#28

"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?

Clicking through the links, this post appears to be the source: https://news.ycombinator.com/item?id=4128470

As another commenter noted, the exception appears to be September 1752.

That's a fun example but whether it's worth worrying about is another question...

Re: Falsehoods programmers believe about time

#29
post #21

"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?

I'd expect in a lunar calendar system? (where 12 lunar months are to short to fill a year, and I think some of them fix this by inserting an extra half-month) But I wish this list came with examples, and if it really means a different calendar system it's IMHO not as interesting, because it's IMHO fairly obvious that different calendar systems follow different rules. Or maybe during the switch to Gregorian calendar?…

Lunar month is a little over 29 days on average. And most lunar calendars do not align with solar year but rather have leap months added. E.g. Hebrew calendar [1].

[1]: https://en.wikipedia.org/wiki/Hebrew_calendar

Re: Falsehoods programmers believe about time

#30

"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?

If I am not wrong this holds true for the switch from Julian calendar to the Gregorian one. Some months were shortened to be synchronised with the new system. And if I am not mistaken Jewish and Arabs do not use the same systems we use for months and years

For an added twist this changeover occurred in different years, at different times in different countries .. and not always with the same number of days difference.

Good Times.

Post reply on HN