Pivoting

Gary E. Miller gem at rellim.com
Mon Apr 24 01:41:15 UTC 2017


Yo Eric!

On Sun, 23 Apr 2017 20:00:33 -0400
"Eric S. Raymond" <esr at thyrsus.com> wrote:

> Gary E. Miller <gem at rellim.com>:
> > Yo Eric!
> > 
> > On Sun, 23 Apr 2017 17:44:20 -0400
> > "Eric S. Raymond" <esr at thyrsus.com> wrote:
> >   
> > > Achim Gratz <Stromeko at Nexgo.DE>:  
> > > > I don't think ntpd needs to do any pivoting _except_ at startup
> > > > time, where it is unavoidable and it should attempt to do
> > > > anything after it has started up.    
> > > 
> > > Huh?  Potentially you need to apply a pivot to every packet that
> > > comes in; different sources could even have different epochs.   
> > 
> > Not really.  2s complement fixes it for packet up to many years
> > apart.  Remember, all ntpd uses, after the first time, is time
> > deltas.  
> 
> I don't understand this remark.  We're being shipped timestamps from
> upstream, not merely deltas.

Yes, but when we subtract from our local time, truncated to an l_fp,
and 2s complement, we end up with a delta on local time.  Once 
we get runnning, any delta past 'gate' is thrown away.  That gate,
by default is just 1,000 seconds.

So. after the first big correction, we KNOW the delta is 1,000 seconds
or less and 2s complement arithmetic over the epoch rollever is fine.

I'd be happy to create some test cases showing the effect.  But to
really use them we'll need hooks into that area of ntpd.

But for example on these dates:

		NTP Epoch	NTP Era		NTP Datestamp
1 Jan 1900              0             0                   0
27 Feb 2036             0             1         0x100000000

So at the roll over, any time greater than 1,000 seconds in the 
past or the future will be rejected.

The only acceptable time stamps will be between:

                    NTP Epoch
EPOCH - 1,000 sec       0x3e8
EPOCH + 1,000 sec  0xfffffc18

Plug those into the hex calculator of you choice and you can see that
subtracting thos from zero very neatly give you a plain and simple
offset as an l_fp.

Subtract 0x3e8 from zero and you get 0xfffffca8, which is conventiently
the offset of -1,000 seconds.  Feel free to compute the other
permutations.

> > > Instead of trying to use this for precise time, we could try
> > > using a Date just at startup to figure out what era we are in.  
> > 
> > Except for ntpd that is not net connected.  A more common condition
> > than I would have thought.  
> 
> I want to make that case work better too.  Doesn't mean this couldn't
> be useful to a normal client-only setup.

Diconnected is the hard case, get that right and the others are already
done.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170423/abfc44c3/attachment.bin>


More information about the devel mailing list