[ntp:questions] Leap second functional question

David Woolley david at ex.djwhome.demon.co.uk.invalid
Tue Feb 19 08:15:12 UTC 2008


Unruh wrote:
> David Woolley <david at ex.djwhome.demon.co.uk.invalid> writes:

>> The date error is significant because, once one realizes there are only 
>> two possible days a year, it becomes unimportant when the flags are set 

> Well, no, it is still important on those days. It does not occur every year
> or every day ( in fact I think we have not had one in about 4 years). 

But you can safely have it set for most of the previous six months and 
the following six months, whereas the questioner is assuming it must be 
cleared immediately the leap second has been implemented and not set 
more than a very short time in advance.  (It certainly has to be set 
hours in advance, because some clients may not have polled within an 
hour, and each stratum can extend the propagation delay of the setting 
of the flags.)
> 
> 
> 
>> The current code basically checks the date and only sets the bits if it 
>> is one of those two days.
> 
> No, it does not. It only sets the bit if it has been told by a majority of
> its servers that a leap second is coming up. And we had a number of people

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;
                                 }
                         }

> having trouble in that a leap second seemed to have been announced to them
> in the middle of Jan this year. Ie, ntp on your system relies on your
> servers to tell about leap second. It is announce a month before hand and
> then on the day.

That tends to confirm that it has been acceptable to set the flag any 
time after the preceding candidate time.




More information about the questions mailing list