| > Build your time library on (un)signed 64 bit integers representing the number of nanoseconds since the utc epoch. You poor sweet summer child. Has no one told you about the leap seconds yet? Unix time is not the number of seconds since epoch. It deliberately excludes leap seconds, which happen unpredictably whenever scientists measure the Earth as having spun at a different enough speed for long enough. Time is fucked on every level: - Philosophical: What is time? We just don't know. - Physical: Turns out there is no such thing as simultaneity, and time flows differently at different locations. Time may be discrete at the Planck level, but we don't really know yet. - Cosmological: The Earth does not rotate at a constant speed, the Earth does not orbit the Sun at a fractional component of its rotation, and the Moon does not orbit at even ratio either. - Historical: Humans have not used time or calendars consistently. - Notational: Some time notations are ambiguous (e.g. during daylight savings transitions) and others are skipped. - Regional: Different regions use subtly different clocks and calendars. - Political: Different political actors choose to change time whenever they feel like it with little or no warning. - Religious: Many religions come with their own system for timekeeping, and people don't like when outsiders impose other systems. |
haha. Google is way ahead of you and your "leap seconds".
"Since 2008, instead of applying leap seconds to our servers using clock steps, we have "smeared" the extra second across the hours before and after each leap. The leap smear applies to all Google services, including all our APIs."
https://developers.google.com/time/smear
...now write code to convert Google time to any other random type of time.