REMINDER: LEAP SECOND

Harlan Stenn stenn at ntp.org
Tue Jun 23 07:46:50 UTC 2015


This stuff can make my head explode.

When a leap second is added, like on 30 June 2015 at the last second of
the day, POSIX insists that the day still have 86400 seconds in it.
This makes the day longer by one second, so time has to either slow down
or move backwards.

The "dumb" way to do this is to step the clock back by 1 second at the
instant before the stroke of midnight.

The allegedly better way to do this would be to stop the clock a bit
before midnight, and hold the time for 1 second.  To continue providing
monotonic time, every time somebody says "what time is it" during that
holding period one would want to bump the time by the smallest amount
possible, usually 1 nanosecond (assuming the kernel keeps time in
nanoseconds).

Ideally you wouldn't want to add enough nanoseconds to cause the clock
to roll over into the next day "too early".

But apparently nobody has implemented this, even though Prof. Mills
described it in RFC-i-forget about 20 years ago.

This is mostly because POSIX deals with absolute time and not relative
time.

In the unlikely event of a leap second deletion, there would be no
23:59:59, so when the clock is about to strike 23:59:59 it's OK to add
an extra second to the clock to effectively have the time "jump" from
23:59:58 to 00:00:00.  This is still a monotonic increment in time.

Whatever you decide to do, I recommend you actually test it out to see
if it behaves the way you think it will.  You have a whole week still.

H



More information about the NANOG mailing list