[LEAPSECS] leap seconds in POSIX

Zefram zefram at fysh.org
Mon Jan 27 05:23:24 EST 2020


Hal Murray wrote:
>I assume the basic idea would be something like switch the kernel to use TAI 
>rather than UTC and implement conversion in some library routines.

That's not a viable approach, because of the wide range of uses to which
time_t is put.  One can't rely on being able to perform such conversion
for all uses.  (Though a disturbing number of libraries pretend that
one can, and then convert on the false assumption that there will be no
future leap seconds.)

It'll be necessary to distinguish explicitly between UTC-based and
TAI-based time representations.  Furthermore, the POSIX way is to leave
the existing interfaces unchanged and add new ones.  So if the kernel is
to do anything TAI, then the kernel will have to track both UTC and TAI,
and we can expect to see a new clockid_t value for the TAI version of
CLOCK_REALTIME.  The less-invasive option is to keep the kernel UTC-only,
adding a clockid_t value for the proposed leap-second-capable CLOCK_UTC,
and do all TAI work in user space.

-zefram


More information about the LEAPSECS mailing list