[ntp:hackers] smearing the leap second

Miroslav Lichvar mlichvar at redhat.com
Fri Jun 19 13:16:23 UTC 2015


On Fri, Jun 19, 2015 at 12:49:52PM +0200, Terje Mathisen wrote:
> What remains is the exact smearing approach, here I would also use the
> proven Google approach, i.e. a cosine smear over 12 hours on both sides of
> the event: This keeps the first and second order derivatives well below the
> ntpd control loop limits, while limiting the maximum absolute offset to 0.5
> seconds.

It seems this year Google will actually use a simple linear smear [1].
I presume this is to keep clocks of clients following a leap smearing
server close to clocks of clients that follow normal server and slew
clock for leap second locally instead.

Anyway, a quadratic spline function might be a better choice than
cosine. The advantage is that the maximum wander is ~20% smaller when
smearing over the same interval and the calculation is cheaper, no
need for lookup tables. FWIW, that's what is used in the chrony NTP
implementation and it seems to be working very well.

I did also some experiments with a higher order function to have
wander starting at zero and allow the clients to adjust their polling
interval before the wander reaches the maximum and minimize the
initial offset swing, but with ntpd as a client I didn't see any
interesting improvement.

> >> On Jun 19, 2015, at 02:11, Harlan Stenn <stenn at nwtime.org> wrote:
> >> I'm inclined to include this code, or something like it, and just
> >> clearly document/publish the various pros/cons involved.
> >>
> >> Does anybody have strong opinions either way about this?

Until all NTP clients are advanced enough to have an option to correct
the clock for leapsecond by slewing or leap seconds are abolished, I
think there will always be a need to smear the time on server. Just
like with the -x option, make sure it's properly documented so people
are less likely to shoot themselves in the foot.

[1] http://googlecloudplatform.blogspot.com/2015/05/Got-a-second-A-leap-second-that-is-Be-ready-for-June-30th.html

-- 
Miroslav Lichvar


More information about the hackers mailing list