[ntp:questions] Leap second functional question
Danny Mayer
mayer at ntp.isc.org
Thu Feb 21 22:01:31 UTC 2008
David Woolley wrote:
> 4p4's ntpd/ntp_loopfilter.c:
> /*
> * Set the leap bits in the status word, but
> * only on the last day of June or December.
> */
> tstamp = peer->rec.l_ui - JAN_1970;
> tm = gmtime(&tstamp);
> if (tm != NULL) {
> if ((tm->tm_mon + 1 == 6 &&
> tm->tm_mday == 30) || (tm->tm_mon +
> 1 == 12 && tm->tm_mday == 31)) {
> if (leap_next & LEAP_ADDSECOND)
> ntv.status |= STA_INS;
> else if (leap_next &
> LEAP_DELSECOND)
> ntv.status |= STA_DEL;
> }
> }
That comment is wrong. IIRC it can nominally be set at the last day of
any month. The norm is the last day of June or December and in practice
has been only the last day of December. Notice that the code does not
allow a leap second in February which only has 28 or 29 (this year) days
in the month. Either this is a bug or it's already been fixed.
Danny
More information about the questions
mailing list