Live data from Hacker News

Insane complexity of calendrically correct date and time operations

yourcalendricalfallacyis.com

71–80 of 146 posts

Re: Insane complexity of calendrically correct date and time operations

#71
post #40
post #19

Earlier quoted context omitted.

Not wanting to be a complete BSD bigot, I can't actually remember if this broke in the {Free,Net,Open}BSD world as badly. The 2015 docs for FreeBSD don't help (oh, for a time machine) but go to "you can test what we do" which is good. https://www.freebsd.org/doc/en_US.ISO8859-1/articles/leap-se...

BSD is actually worse, it doesn't handle leap seconds at all, it simply ignores their existence and assumes the clock was simply inaccurate. That's fine as far as it goes, but make sure never to use a BSD machine as an NTP server or you will cause a lot of confusion for any servers downstream.

I don't know about OpenBSD or NetBSD but I've witnessed FreeBSD handling leap second correctly. I also witnessed OpenNTPD ignoring it and that's documented, so I suspect OpenBSD doesn't handle leap seconds at all.

Re: Insane complexity of calendrically correct date and time operations

#72
post #4
post #2

Is it true that Unix time is as simple as it seems? Is there exactly one second between adjacent integers? Do all Unix time values occur only once simultaneously around the world?

What you want is probably TAI [1], Unix Time has leap seconds. [1] https://en.wikipedia.org/wiki/International_Atomic_Time

The one mistake with UNIX is that UTC is used. It should have been TAI, and leap second adjustment should have been handled by the timezone package (but at the time people weren't worried about leap seconds, so it's understandable). As it is, the system clock has to change. This is as bad as MSDOS time (and other systems which put localtime into the actual RTC). Using UTC as the time reference, independent of local time, was nearly genius. With TAI it would have been pure genious. No, wait, using an epoch time of the Big Bang, and step size Planck time, now that would have been pure genious. It doesn't take as many bits as you may think..

Re: Insane complexity of calendrically correct date and time operations

#73
post #43

Earlier quoted context omitted.

simple: call them by their ordinal/cardinal names. that's what east asian calendars do. october is "month ten" https://en.wikipedia.org/wiki/Japanese_calendar#Months https://en.wikipedia.org/wiki/Names_of_the_days_of_the_week#...

That's what we did in latin! October is month 8! And then some dude messed it up.

Yeah, the dude changed the definition of where the new year starts, moving it back two months. It's still arbitrary, it should have been at the (slightly fuzzy) winter solstice..

Re: Insane complexity of calendrically correct date and time operations

#74
> Weeks start on Sunday in the United States, Monday in Europe, and a couple of places start on Saturday.

Wow. I live in Europe, and find it weird that people can consider the week to start on Sunday.

I guess everything that may appear normal within a cultural frame of reference can be off in another, even the most basic of things!

Re: Insane complexity of calendrically correct date and time operations

#75

> Weeks start on Sunday in the United States, Monday in Europe, and a couple of places start on Saturday. Wow. I live in Europe, and find it weird that people can consider the week to start on Sunday. I guess everything that may appear normal within a cultural frame of reference can be off in another, even the most basic of things!

What is the relevance of saying that a week starts on a particular day? In the most common usage, the "week" starts on Monday in the United States, and concludes on Friday, to be followed by the "weekend". A calendar week of 7 days does start on Sunday, but who cares? If they changed how the calendars were printed, life would be different in no way.

Re: Insane complexity of calendrically correct date and time operations

#76
Bonus problem: in my company, the business calendar (which is the first week of the year, quarter ends) is sometimes shifted by one week with respect to the ISO definitions for historic reasons.

I have implemented a large application which does a lot of time calculations, and run onto most of the issues listed in the article, except that I didn't use hewbrew calendars :).

Re: Insane complexity of calendrically correct date and time operations

#77
> Weeks start on Sunday

> False. Weeks start on Sunday in the United States, Monday in Europe, and a couple of places start on Saturday.

In some countries weeks start on Mondays.

> All the important years are four digits long

> False. It’s the year Heisei 30 in the Japanese calendar.

Or 13.0.5.15.0 in the Maya calendar.

Re: Insane complexity of calendrically correct date and time operations

#79

> Weeks start on Sunday in the United States, Monday in Europe, and a couple of places start on Saturday. Wow. I live in Europe, and find it weird that people can consider the week to start on Sunday. I guess everything that may appear normal within a cultural frame of reference can be off in another, even the most basic of things!

> I live in Europe, and find it weird that people can consider the week to start on Sunday.

You are almost certainly neither Portuguese nor Maltese.

In these two European languages, the days of the week are literally numbered as if Sunday were the first day of the week.

Portuguese: Monday is "segunda-feira" which means something like "second market day" Maltese: Monday is "it-Tnejn", which AFAICT means "the second [day]"

In both languages, most of the other days have similar names, representing their position in a week that starts on Sunday.

Re: Insane complexity of calendrically correct date and time operations

#80
post #9

This could very well have been called “ Falsehoods programmers believe about date and time calculations ”. It fits very well into the pattern of other similarly titled lists which have been published in recent years.

https://infiniteundo.com/post/25326999628/falsehoods-program... edit: which cites https://infiniteundo.com/post/25326999628/falsehoods-program... (from HN's own patio11) as inspiration, as the original "Falsehoods programmers believe about X".

There's a follow-up: https://infiniteundo.com/post/25509354022/more-falsehoods-pr...
Post reply on HN