[tz] leap second theory
guy at alum.mit.edu
Sat Aug 17 19:22:38 UTC 2019
On Aug 17, 2019, at 5:29 AM, Steve Summit <scs at eskimo.com> wrote:
> I was trying to point someone to a reference describing how
> the "right" zones can be used to enable a system to handle
> leap seconds more correctly, but I discovered that this isn't
> really documented anywhere. (There's Steve Allen's page at
> https://www.ucolick.org/~sla/leapsecs/right+gps.html , of course,
> but that describes a distinct variant of the scheme.)
> Would it make sense to add something like the attached patch
> to theory.html?
I might have it say something more like
The mechanism assumes that the time stamps being converted count all seconds since January 1, 1970 00:00:00 UTC, *including* leap seconds. (This is by contrast to Posix time stamps, which explicitly ignore leap seconds.)
Note that time stamps that include leap seconds will not match Posix UTC time_t values.
making it a property of the time stamp value rather than of the OS, and emphasizing that the epoch being used is the same as for POSIX time stamps (rather than being whatever the TAI version of January 1, 1970 00:00:00 would be called, PTP-style). A UN*X system might, for example, have gettimeofday() etc. continue to offer POSIX timestamps and have a separate API that returns time stamps that advance by 1 second every second.
More information about the tz