[ntp:questions] Leap second question
Martin Burnicki
martin.burnicki at meinberg.de
Thu Mar 21 13:50:53 UTC 2013
Terje Mathisen wrote:
> Stephen Yu wrote:
>> Hello,
>>
>> In the dev release ntp-dev-4.2.7p361, the file ntp_timer.c has the
>> following code to set "sys_leap".
>>
>> if (leapsec > 0) { leapsec--; if (leapsec == 0) { sys_leap =
>> LEAP_NOWARNING; ......................... } else { if (leapsec <
>> DAY) sys_leap = LEAP_ADDSECOND; if (leap_tai > 0) sys_tai = leap_tai
>> - 1; } }
>>
>> The question is why "sys_leap = LEAP_ADDSECOND" is unconditional. Is
>> this based on the prior knowledge that earth always rotates slower?
>> In other word, could it ever be "sys_leap = LEAP_DELSECOND"?
>
> You are correct, this is a bug, but it will almost certainly never hit
> us, since everything so far indicates that leap seconds will never be
> deleted.
>
> The fix is relatively obvious, the most important tweak is that a
> negative leap second must be applied one second earlier, i.e. at
> 23:59:59 instead of midnight, so the countdown will be one second less.
>
> Terje
Hm, AFAIK *ix most kernels can do this, if they receive an appropriate
announcement (though I've never tried this), GPS can propagate
"negative" leap seconds, PTP can, NTP (the protocol) can, and ntpd used
to be able to handle this up to version 4.2.4.
I don't know (and don't understand) why the code which was prepared to
handle leap second deletions has been removed in 4.2.6 ...
Martin
--
Martin Burnicki
Meinberg Funkuhren
Bad Pyrmont
Germany
More information about the questions
mailing list