[ntp:questions] Leap second functional question

David L. Mills mills at udel.edu
Thu Feb 21 23:15:54 UTC 2008


Danny,

That snapshot is older than I thought. That particular botch of code 
along with other botches was vulnerable to whimsical errors, like server 
leap bits popping up and down or leapsecond file update. The current 
code here can leap at the end of any month, which seems to be the 
prevailing view of the standards folks. However, I can't find 
confirmation at the IERS site.

Dave

Danny Mayer wrote:
> 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