Hacker News new | ask | show | jobs
by yosamino 2101 days ago
It's a question of knowing your data.

UTC time probably won't always give you the correct result, since timezones and DST aren't fixed.

Say, you want to store the time of your doctor's appointment months in advance.

Here it makes sense to store the time with a timezone - but not the timezone offset. This makes sense because no matter what the government decides about changing DST or moving timezone offsets alltogether - your doctor's appointment is going to be at 0900am at a specific geographic location and since you will physically be there with your watch synchronized to your doctor's.

But say you have an online appointment with your psychotherapist who lives in a completely different timezone (possibly you do not know which one) from you at some specific time in the future.

Here making the appointment via UTC makes sense - to meet up you need a globally synchronized clock.

The hard part: how do you know determine whether you can schedule these two one-hour appointments right after each other and not have a conflict ? I am not sure it's perfectly possible.

2 comments

It would be nice if systems monitored time zone definition changes so you could receive a notification like "Due to a time zone or DST definition change, your appointments now conflict". This has probably not been implemented anywhere.
You would still store both future times with offset. When calculating an offset for a future time you take the future time and the zone together to determine the exact time with offset. DST is predictable.
> DST is predictable

No it isn't.

* Europe postponed planned DST abolition due to COVID19: https://www.timeanddate.com/time/europe/eu-dst.html

* Argentina had a period of deciding each year what the DST dates would be until one year they just decided not to: https://en.m.wikipedia.org/wiki/Daylight_saving_time_in_Arge...

* Morocco and Yukon, Canada made updates to their DST policies earlier this year: https://mm.icann.org/pipermail/tz-announce/2020-April/000058...

DST schedules change several times each year, often with little prior notice. They changed in North America in 2007, which caused a lot of pain for software that thinks DST is predictable, such as Microsoft Exchange.