F-ckin Leap Seconds, how do they work?

Scott Howard scott at doc.net.au
Wed Jul 4 17:22:46 UTC 2012

On Wed, Jul 4, 2012 at 8:50 AM, Jimmy Hess <mysidia at gmail.com> wrote:

> The NTP daemon could still provide a configuration option to not
> implement leap-seconds locally,  or ignore the leap-second
> announcement received.     So the admin can make a tradeoff  favoring
> Stability over Correctness, of _allowing_  the local clock to become 1
> second inaccurate  for a short time after the rare occasion of a leap
> second;  and step it or slew the local clock,  eg  include the leap
> second in the ordinary time correction,  averaged over a period of
> time instead of a 1 second jump.

Unless I'm mis-reading things, it already does - of sorts.

According to the ntpd website (
http://www.ntp.org/ntpfaq/NTP-s-algo-real.htm#AEN2499) :
*The theory of leap seconds in explained in Q: 2.4.. In reality there are
two cases to consider:

    If the operating system implements the kernel discipline described in
Section 5.2, ntpd will announce insertion and deletion of leap seconds to
the kernel. The kernel will handle the leap seconds without further action

    If the operating system does not implement the kernel discipline, the
clock will show an error of one second relative to NTP's time immediate
after the leap second. The situation will be handled just like an
unexpected change of time: The operating system will continue with the
wrong time for some time, but eventually ntpd will step the time.
Effectively this will cause the correction for leap seconds to be applied
too late.

Linux does implement the "kernel discipline" (via ntp_adjtime), so the
first option is what normally happens.  However you can disable this with
an ntpd config option ("disable kernel") or via ntpdc at which point I'm
presuming it will fall back to the second option.

The second option still gives you a step, but using the -x option to NTPD
will slew this step, giving a gradual correction to the 1 second difference.

Of course there would be side effects of this (the kernel implementation of
NTP is there for a reason, and this disables it), but at least it's better
than a server hang...


More information about the NANOG mailing list