logoalt Hacker News

ppchainyesterday at 9:21 PM4 repliesview on HN

The issue described in the post is an example of when you cannot just rely on Unix timestamps. Specifically it comes down to which date is authoritative.

A appointment with your dentist at 2pm Pacific Time in December 2026 has changed Unix timestamps in British Columbia. The dentist doesn't care about the Unix timestamp, she cares about the wall clock local time when you arrive for the appointment.


Replies

Terr_yesterday at 10:35 PM

To frame it another way, your dentist has agreed to a particular triggering condition. (Whether they realize that's how their country works or not.)

We can all make pretty-good guesses about when that condition will be fulfilled in N seconds, but until it actually finally happens, the true occasion could land somewhere else.

"Three months later at 2PM where I live" is not so different than "when the thrush knocks during the setting light of Durin's Day." You can guess that it's N seconds from now, but you might be wrong.

XYen0ntoday at 3:23 AM

How does your system know when it is 2pm in British Columbia?

jedbergyesterday at 9:27 PM

I edited my comment to make it clearer. I meant you should only directly store current timestamps, anything else you should leave up to a library to store as it sees fit.

show 1 reply
ngaheeryesterday at 9:34 PM

"Which date is authoritative".

I don't understand this. The consumer books in his/ her local time stamp i.e. 12 PM pacific. Gets stored as Epoch milliseconds (and is passed around as a data structure i.e. Date struct with UTC as the timezone) and the providers sees the time stamp 3 PM EST or 2 PM CST depending on it's timezone at runtime (interface the provider it works with).

I don't understand why a specific timezone has to be "authoritative" here. What am I missing.

show 6 replies