Time to slow down and be more careful

Hal Murray hmurray at megapathdsl.net
Tue Apr 18 02:42:04 UTC 2017

>> I changed things so that there is never a conversion from l_fp
>> to full time. There is a subtract done on the l_fp side.  The clock
>> offset in l_fp is converted to an offset in seconds.  I think it's a
>> double.  That eventually turns into a clock adjustment.  There is
>> no explicit pivot.  There is an implicit pivot of the current time.

> I'm actually not sure which code you're talking about here, and I think it's
> important that I should. 

You added some pivot code to step_systime in libntp/systime.c
I don't understand why.

The argument is a time step as a double.  That comes from packets exchanged with a server using l_fp.  That's at most 31 bits plus sign, relative to the current system time.  That's the biggest step you can take.  You can step across epoch boundaries.  You can't step over whole epochs.

If you want to cross an epoch boundary, the system you are running on must support the new epoch.  That will require more than 32 bit time_t.  (It might work with 32 bit unsigned, but all sorts of code does subtracts.)

Note that there is no pivot mentioned in the previous two paragraphs.  The pivot point is "now".  That turns into a requirement that the system time be close enough.

You added
          l_fp fp_ofs, fp_sys; /* offset and target system time in FP */

The idea was to avoid l_fp in anything that talks to the OS.  If you use timespec, and assume time_t is 64 bits, then you don't need to worry about epochs or pivots.

Does that help?

These are my opinions.  I hate spam.

More information about the devel mailing list