[ntp:questions] POSIX leap seconds versus the current NTP behaviour

David L. Mills mills at udel.edu
Wed May 4 20:10:08 UTC 2011


Holy timewarp! Are you the same Dennis Ferguson that wrote much of the 
original xntpd code three decades ago? If so, your original leapseconds 
code has changed considerably, as documented in the white paper at 
www.eecis.udel.edu/~mills/leap.html. It does not speak POSIX, only UTC. 
This applies to both the daemon and the kernel.


Dennis Ferguson wrote:

>A strict reading of the part of the POSIX standard defining "seconds
>since the epoch" would seem to require that when a leap second is added the
>clock should be stepped back at 00:00:01.  That is, the second which should
>be replayed is the second whose "seconds since the epoch" representation is
>an even multiple of 86400.  Right now the NTP implementation doesn't do that,
>it instead steps the clock back at 00:00:00 and replays the second which is
>one before the even multiple of 86400 in the "seconds since the epoch"
>representation, to match what seems to be required for the NTP timescale.
>For a new implementation of this is there any reason not to do the kernel
>timekeeping the way POSIX seems to want it?  I thought I preferred the NTP
>handling since it seemed to keep the leap problem on the correct day (for
>an "all days have 86400 seconds" timescale, which describes both the NTP and
>the POSIX timescales), but I've since decided that might not be all that
>important and I appreciate the symmetry of the POSIX approach (leaps forward
>occur at 23:59:59, leaps back at 00:00:01, and both leaps end up at 00:00:00)
>as well as the fact that the POSIX approach yields a simple equation to determine
>the conversion from time-of-day to seconds-since-the-epoch which is always
>valid, even across a leap (and even if the inverse conversion is ambiguous)
>while I'm having difficulty finding a similar description of NTP's behaviour.
>Dennis Ferguson
>questions mailing list
>questions at lists.ntp.org

More information about the questions mailing list