by thymelord · 10y ago · 0 comments
Accurate time is one of the most difficult things to model in computer science.
This talk explains it VERY nicely: https://www.youtube.com/watch?v=2rnIHsqABfM
Basically just decide whether you're trying to store an absolute time (a timestamp will do) or a civil time (year, month, day, etc.) and treat them as two separate data types.
(If you just use "civil time + offset from UTC" like RFC 3339 does, then you can convert it to an absolute time, but you can convert only that one specific value using that offset, and not any other - i.e. that offset is not a substitute for an actual timezone identifier.)
If you have sub-second precision and expect Unix time seconds to always go forward, or if you expect every Unix second to last a second (eg. by computing Unix time differences), things might break.
Not even close.
http://www.creativedeletion.com/2015/01/28/falsehoods-progra...
The video is wrong then.
If you're writing an application that deals with times (e.g. stores and queries events with specific timestamps) and you don't take offsets and DST values into account, you get all kinds of weird edge cases.
That doesn't make a lot of sense, as UTC does have leap seconds. It is similar to saying that the fastest car has no wheels, when you really mean that the fastest vehicle is a rocket.
TAI is the most reliable and easiest to work with. It relies on atomic clock seconds at sea level. https://en.wikipedia.org/wiki/International_Atomic_Time
However, it already has a difference of roughly 40 seconds with UTC (and therefore civil time), and dropping leap seconds in civil time will shift midnight to later in the day.
But as the frequency of leap seconds rapidly increases, maintaining UTC will become harder. They will consider dropping leap seconds from UTC in 2023. It is unlikely that people care about having the sun rise at midnight in 30000 years.
Pedantic much? Posting in technical forums is such a bother. People pick at any unimportant detail.
Reworded just for you:
The only reliable time stamp would be something like UTC but without leap seconds.
I too wish we used TAI-based timestamps instead of Unix timestamps in a more widespread manner!
It is a bit silly that we cannot determine any duration involving a UTC time a couple of years in the future…
Who thought February going from 1-29 instead of 1-28 was a good idea?
I don't understand why everyone seems to believe that the phenomena are so inherently different.
60 seconds in a minute, OTOH, is a very strong assumption in many systems and people's minds.
I really don't think this has much to do with it. It would predict no problems trying to add a November 31 to some year; I tend to make the opposite prediction.