Live data from Hacker News

Insane complexity of calendrically correct date and time operations

yourcalendricalfallacyis.com

101–110 of 146 posts

Re: Insane complexity of calendrically correct date and time operations

#101
post #91

Earlier quoted context omitted.

In parts of the world, weeks of the year are numbered, so that you can talk about things happening "in week 43", and so on. For such a system, it's of course quite important to agree on which day a new week begins. Also (again, as a European) it feels very odd to not have the weekend (Saturday and Sunday) be at the end of the week, but instead "straddle" between two weeks. I found the original article a bit strange i…

In the US, weeks are not numbered, and the way to refer to a week is e.g. "the week of the 10th". (If you're talking about a different month, "the week of September 10th".) You would usually name the Monday of the week because the context is usually work-related. I question whether "Thursday of week 37" is really that much clearer than "Thursday, September 13".

Indeed, it isn't. I'm living in a country where my company as well as our (foreign) customers use week numbers all the time. It's painful. My watch doesn't show the week number. A normal calendar doesn't. The company calendars do, but there's never one nearby when I need one. So I have a bookmark in my web browser to a 'week calendar' on the net. I can use a 'date' command, but the actual +% syntax always disappear from my mind, so I have to look it up. Week numbers is just a pain. You can't even be sure about week 1 or week 52, it depends on the weekdays that year.

Re: Insane complexity of calendrically correct date and time operations

#102

Earlier quoted context omitted.

So for all intents and purposes, the week actually starts on Monday in the US, if I understand what you're saying. For instance, if I were to tell you "Beginning of next week, I'm gonna X", you'd understand Monday, correct?

If you said that to me at work, I'd understand Monday, because Sunday is not part of the work week. I'd likely understand it as Monday in other contexts too, because it's very rare for something to start on Sunday. Monday and Saturday are the transition points and thus the logical places to start doing something. But I might understand it as Sunday if context seemed to point that way. What I'm saying is that nothing…

No hard implications, but it might influence how you number the days (C99's tm_wday uses 0-6 with 0 = Sunday, which suggests a week starting with Sunday, particularly since tm_mon uses 0-11 with 0 = January, but is also compatible with the way the days are numbered in Chinese, with Monday = 1), and it might be related to how you work out which months have 4 weeks and which months have 5 weeks: it's unusual, but some part-time employees get 4 weeks' pay at the end of most months but 5 weeks' pay at the end of some months, bizarrely.

Re: Insane complexity of calendrically correct date and time operations

#103
post #100

Earlier quoted context omitted.

This is why some Google and AWS smear the leap second. https://developers.google.com/time/smear https://aws.amazon.com/blogs/aws/look-before-you-leap-the-co...

Imho that's no better. A leap second "smears" the day lengths. Smearing the leap second means introducing changes at some scale, eg. more or less micro- or nanoseconds. Software needs ro be able to cope with this.

I had the same thought but...

The smear technique results in seconds that are 11.6μs longer than nominal, and Google makes the case this is within the "manufacturing and thermal errors of most machines' quartz oscillators". So at face value, I'd say software already copes with discrepancies of that order.

However I would infer the maximum delta actually seen by an NTP client is larger and depends on the client's polling interval. e.g. If a machine runs a normal clock locally and synchronizes every 20 minutes (which is probably on the high side), it would see about a 14ms jump on each sync during the 24 hour smear window.

That's assuming the NTP client doesn't already use a smear algorithm locally to correct for drift (Windows doesn't, but I think Red Hat Linux might? Per https://access.redhat.com/solutions/39194 "NTP polling does not directly synchronize the local system clock to the server clock; rather, a complex algorithm calculates an adjustment value for each tick of the local system clock")

Maybe someone more well-versed can elaborate further.

Re: Insane complexity of calendrically correct date and time operations

#104

> 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 [d…

It's the same in Greek, Monday means "Second" but still, everybody considers it the first day of the week.

Re: Insane complexity of calendrically correct date and time operations

#105
post #91

Earlier quoted context omitted.

In parts of the world, weeks of the year are numbered, so that you can talk about things happening "in week 43", and so on. For such a system, it's of course quite important to agree on which day a new week begins. Also (again, as a European) it feels very odd to not have the weekend (Saturday and Sunday) be at the end of the week, but instead "straddle" between two weeks. I found the original article a bit strange i…

In the US, weeks are not numbered, and the way to refer to a week is e.g. "the week of the 10th". (If you're talking about a different month, "the week of September 10th".) You would usually name the Monday of the week because the context is usually work-related. I question whether "Thursday of week 37" is really that much clearer than "Thursday, September 13".

Perhaps it's not, but it is a bit more compact and even more so in my native language, Swedish. The names of months are longer: "September", which is the same word in Swedish has four syllables while the word for week ("vecka") has two.

And sometimes you really want to speak about the entire week without naming a day ("we'll have the first boards week 40, smoke-test and bring-up during week 41, and then start proper development by week 42"), since it's times in the future and you don't want to be too specific but still align work tasks with weeks.

Also (re: a sibling comment) Google Calendar shows week numbers, or can be configured to. For quickly finding out the week number, there's always https://vecka.nu. :)

Re: Insane complexity of calendrically correct date and time operations

#106

> 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 mean … I was aware of the fact that the week starts on Sunday in a LOT of other places. But still.

So Sunday, the first day of the week, is still part of what's called the weekend, right?

Re: Insane complexity of calendrically correct date and time operations

#107

"False. The UNIX epoch is January 1, 1970 in UTC, but is Dec 31, 1969 in Los Angeles." This isn't specific to Los Angeles, right? It's just referring to the fact that anyone with a negative UTC offset would see an epoch date of Dec 31, 1969 in their local time (I hope).

Yes.

This reminds me of an anecdote from a talk on timezones. Shortly after Stephen Hawking died, the the Google search snippet for "When did Stephen Hawking die" said "Tomorrow" for people in the US.

It was pulling the date from Wikipedia, but it was still the previous day in the US.

Re: Insane complexity of calendrically correct date and time operations

#108
post #105

Earlier quoted context omitted.

In the US, weeks are not numbered, and the way to refer to a week is e.g. "the week of the 10th". (If you're talking about a different month, "the week of September 10th".) You would usually name the Monday of the week because the context is usually work-related. I question whether "Thursday of week 37" is really that much clearer than "Thursday, September 13".

Perhaps it's not, but it is a bit more compact and even more so in my native language, Swedish. The names of months are longer: "September", which is the same word in Swedish has four syllables while the word for week ("vecka") has two. And sometimes you really want to speak about the entire week without naming a day ("we'll have the first boards week 40, smoke-test and bring-up during week 41, and then start proper…

> Also (re: a sibling comment) Google Calendar shows week numbers, or can be configured to. For quickly finding out the week number, there's always https://vecka.nu. :)

KDE and i3 desktops can be configured for pretty much arbitrary date formats, I always have the KW in there.

Re: Insane complexity of calendrically correct date and time operations

#109
post #36

Earlier quoted context omitted.

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

I think you meant it cites https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-...

You're right, thank you. I missed the edit window.

Re: Insane complexity of calendrically correct date and time operations

#110

> 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!

It's not a U.S./Europe dichotomy. The first day of the week being Sunday is a Judaeo-Christian, and Islamic, thing.

For countries with these as official religions you will find that offically Sunday is still the first day of the week for many purposes. For example: In the U.K., officially still Protestant, a week for the purposes of statutory sick/maternity/paternity pay or national insurance begins on a Sunday. Sunday trading legislation was talking about weeks commencing on Sunday as recently as 1950.

* http://www.legislation.gov.uk/uksi/2014/1640/article/2/made

* http://www.legislation.gov.uk/ukpga/Geo6/14/28/section/22/en...

If you think that millennia-old traditions, which you can still find observed in Europe if you look, are weird then academic weeks beginning at noon on Wednesday, examples of which can also be found in both the U.S. and Europe, will probably blow your mind.

Post reply on HN