[time-nuts] June 30 2015 leap second
wojciech at owczarek.co.uk
Tue Jan 6 21:19:43 EST 2015
On 7 Jan 2015 00:23, "d0ct0r" <time at patoka.org> wrote:
> The same question is for UNIX epoch time. How computers knows if it is
necessary to add leap seconds ?
During the event, the kernel raw time (assuming UTC) will go from
23:59:58.999999999 straight to 00:00:00.000000000 when removing a leap
second, and when inserting one, Linux for example will go
23:59:59.999999999 to 23:59:59.000000000 again. The time formatting library
functions (aware of leap and time zones) will turn the latter into xx:59:60.
As to how the computer knows - some time sync software (NTPd, PTPd etc.),
which is made aware of the event from upstream, needs to tell the kernel
about this - on systems with the kernel NTP API like Linux, BSDs and
others, this is done by setting a respective STA_INS or STA_DEL status flag
with ntp_adjtime() or adjtimex(). This can be done in kernel up to 24 hours
in advance. When either of the two flags is set, the kernel will trigger
the leap event in the last seconds of the current day. GPS should announce
the pending leap second not long after the IERS announcement. I haven't
checked my clocks yet but it may already be out there.
More information about the time-nuts