[ntp:questions] Preparing for the leap second

Dave Hart hart at ntp.org
Tue Jan 10 20:47:48 UTC 2012


On Tue, Jan 10, 2012 at 19:47, unruh <unruh at invalid.ca> wrote:
> No. Your os does not know about leapseconds, and the only way ntpd knows
> is if the leapsecond flag in the packet exchanged with a server is set.

There are two other ways ntpd learns of pending leap seconds which
override any upstream server leap bits.  First you can install the
leap-seconds file and reference it in ntp.conf:

leapfile "/etc/leap-seconds"

Secondly, autokey clients will securely retrieve the leapseconds
values from autokey servers which use leapfile.

> I believe that the leapsecond handling is actually in the kernel, not in
> ntpd. When ntpd tells the kernel to insert a leapsecond at the day
> turnover, then the system behaves as Mills decribes. (stops the clock
> for a second but returns a monotonic time output if the kernel clock is
> requested for time with a very small delta t.)
> Thus you would have to ask your kernel vendor how it behaves.

The leapsecond support is typically present in both ntpd and the
kernel NTP extensions.  If the kernel loop discipline is enabled, the
kernel is responsible for inserting the leap second as scheduled by
ntpd.  Exactly how the kernel implements that insertion (such as
whether monotonicity is preserved) is implementation-dependent and can
be gleaned from system source code or documentation.  On non-Windows
systems with the kernel loop discipline disabled (by -x or "tinker
step" [1] or "disable kernel") ntpd will step the clock back one
second sometime during the first second of the first of the month,
repeating part of 23:59:59 of the last day of the month.

> Not sure what ntpd does on a Windows system.

On Windows, there is no kernel leapsecond support, but the clock can
run at any rate.  To avoid stepping backwards, the Windows port of
ntpd runs the system clock at 150% of the nominal rate for 2
unmodified seconds starting sometime during the first second of the
month, thus remains monotonic though with two nasty frequency steps.

Cheers,
Dave Hart


More information about the questions mailing list