lfpinit() signed or unsigned?

Eric S. Raymond esr at thyrsus.com
Sat Mar 11 11:21:54 UTC 2017


Achim Gratz <Stromeko at nexgo.de>:
> Hal Murray writes:
> > How about something like l_fp_time (unsigned) and l_fp_delta or l_fp_offset 
> > (signed)?
> 
> The l_fp timestamps must be unsigned since they are just counting
> seconds from the beginning of the epoch.  That means that there's an
> assumption somewhere in NTP that differences between those timestamps,
> which are necessarily signed unless you want to carry the direction of
> the difference as a separate datum, are limited to less or equal than
> half the range of that type.  If you compute that difference in modulo
> arithmetic, then timestamp differences between two adjacent epochs are
> still valid as long as the true time difference is less than half an
> epoch.  In other words, you don't have to explicitly check for the epoch
> of either timestamp if you assume that these are less than 68 years
> apart.

I also confirm this.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

Please consider contributing to my Patreon page at https://www.patreon.com/esr
so I can keep the invisible wheels of the Internet turning. Give generously -
the civilization you save might be your own.



More information about the devel mailing list