[ntp:questions] Leap second functional question

Dean Weiten dmw at weiten.com
Sun Feb 17 23:56:41 UTC 2008


Hmm, I **said** that it was a contrived example.  Let me put it more 
correctly.

Dean.


Contrived Example - Adding a Leap Second
========================================
As an example, let's say that there was a leap second to be added on 
2008-01-01 at 00:00:00.

If the leap second indicator bits turn off at the **end** of the leap 
second it announces, and if the timestamp increases monotonically right 
through, then the values returned in this contrived example might look 
like this:

Time                        Timestamp           Leap Second Bits
----                        ---------           ----------------
2008-02-10 23:59:58.0000    CB2400FE.00000000        01
2008-02-10 23:59:59.0000    CB2400FF.00000000        01
2008-02-10 23:59:59.5000    CB2400FF.80000000        01
2008-02-10 23:59:59.9000    CB2400FF.E6666666        01
2008-02-10 23:59:60:0000    CB240100.00000000        01
2008-02-10 23:59:60.5000    CB240100.80000000        01
2008-02-10 23:59:60.9000    CB240100.E6666666        01
2008-02-11 00:00:00.0000    CB240101.00000000        00
2008-02-11 00:00:01.0000    CB240102.00000000        00

Contrived Example - Deleting a Leap Second
==========================================
Another contrived example, let's say that there was a leap second to be 
removed on 2008-01-01 at 00:00:00.

Then the values returned in this contrived example might look like this:

Time                        Timestamp           Leap Second Bits
----                        ---------           ----------------
2008-02-10 23:59:58.0000    CB2400FE.00000000        01
2008-02-10 23:59:58.5000    CB2400FE.80000000        01
2008-02-10 23:59:58.9000    CB2400FE.E6666666        01
2008-02-11 00:00:00.0000    CB2400FF.00000000        00
2008-02-11 00:00:01.0000    CB240100.00000000        00

Is this correct?  Or, can you mark up my examples to show how I might be 
in error?


David Woolley wrote:
> Dean Weiten wrote:
> 
>>
>> 1. Leap second indicator: shows leap second pending
>>    - how far in advance of the leap second does it start showing it 
>> pending?  One minute?  One hour?  12 hours?  One day?
> 
> At most the whole day.  See ntpd/ntp_loopfilter.c for details.
> 
>>    - I assume that it turns off at the **end** of the leap second it 
>> announces, correct?
> 
> It turns off at the start of the next day.
> 
> In line with being tolerant in what you accept, you should probably only 
> look at the leap indication that existed just before you crossed the 
> candidate insertion/deletion time, and not assume that it will be unset 
> on other days.
> 
> 
>>
>> 2. NTP timestamp: shows seconds since 1900-01-01 00:00:00
>>    - is this value corrected for the leap second event?  Or does it 
>> just increase monotonically right on through, expecting the "listener" 
>> to correct for the leap second?
> 
> It behaves the same way as POSIX time, i.e. you can calculate a civil 
> date and time for any time, except an inserted leap second, without 
> knowing when leap seconds were used.
> 
>>
>> Contrived Example - Adding a Leap Second
>> ========================================
>> As an example, let's say that there was a leap second to be added on 
>> 2008-02-10 at 23:59:59 (hmm, or is that 2008-02-11 at 00:00:00?).  This 
> 
> That's not possible.  The nearest valid leap second insertion point 
> would be the end of December 2007.  The only other candidate is the end 
> of June.
> 




More information about the questions mailing list