Insane complexity of calendrically correct date and time operations
41–50 of 146 posts
Re: Insane complexity of calendrically correct date and time operations
#42Calendars almost never have crazy holes in the middle of them. When you say "I'm in Chicago", you pretty much can schedule an appointment at 1 or 2pm on "Sunday" or "9/20" or "next Wednesday" and everybody knows when that will happen. Leap years cause a little bit of trouble.
Where it gets tricky is when you have to interact with wall clock times, say, calculating the number of hours until your calendar event happens, or looking for all the events in a given range of wall clock dates. This is the world of timestamps, offsets, and "the global timeline" that everyone in the world experiences together.
Calendars also don't really care about daylight saving time.
If you keep these two separate and are specific about which you're dealing with, 90% of this goes away. Separate calendar from arithmetic/wall clock times. Not all will disappear, but a surprisingly large amount.
Source: working on https://www.interval.org/ and using the excellent NodaTime library. Thank you, Jon Skeet.
Re: Insane complexity of calendrically correct date and time operations
#43Imagine we did not have names for months and days. Would you call the tenth month October or December? It does not make sense. Then, the other months at the start of the calendar, would you name them after phases of a military campaign of preparation for war, conquering, looting and pillaging? Would that be deemed politically correct? On the weekday names we are not doing any better. Tuesday - named after the god of…
https://en.wikipedia.org/wiki/Japanese_calendar#Months
https://en.wikipedia.org/wiki/Names_of_the_days_of_the_week#...
Re: Insane complexity of calendrically correct date and time operations
#44Is 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
Re: Insane complexity of calendrically correct date and time operations
#45Re: Insane complexity of calendrically correct date and time operations
#46What surprised me the most on that list was the the Unix epoch is December 31, 1969 in Los Angeles.
Re: Insane complexity of calendrically correct date and time operations
#47The leap second has a history of breaking computers. Pretty much every Linux server running Java broke in 2012, for example. 2009 saw a bunch of Linux kernels crashing in logging code. 2016 was mostly better except for Cloudflare: their systems had an assumption time never runs backwards. https://blog.cloudflare.com/how-and-why-the-leap-second-affe...
Re: Insane complexity of calendrically correct date and time operations
#48This is actually a lot simpler than it looks. There are two concepts. Calendars almost never have crazy holes in the middle of them. When you say "I'm in Chicago", you pretty much can schedule an appointment at 1 or 2pm on "Sunday" or "9/20" or "next Wednesday" and everybody knows when that will happen. Leap years cause a little bit of trouble. Where it gets tricky is when you have to interact with wall clock times,…
The comment right above yours at the moment talks about effectively that very problem (in this case, an unforeseen date moving a calendar back a day).
Re: Insane complexity of calendrically correct date and time operations
#49Re: Insane complexity of calendrically correct date and time operations
#50Imagine we did not have names for months and days. Would you call the tenth month October or December? It does not make sense. Then, the other months at the start of the calendar, would you name them after phases of a military campaign of preparation for war, conquering, looting and pillaging? Would that be deemed politically correct? On the weekday names we are not doing any better. Tuesday - named after the god of…
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#...