lfpinit() signed or unsigned?

Achim Gratz Stromeko at nexgo.de
Wed Mar 22 18:55:23 UTC 2017


Hal Murray writes:
> hmurray at megapathdsl.net said:
>> There is an implicit assumption that the two (l_fp) times that you subtract
>> are in the same epoch. 
>
> Argh.  That's wrong.  It works across the epoch boundary.  The requirement is 
> "close-enough", but you have to stand on your head to recognize that the the 
> boundary crossing can be close.
>
> I'll have to think hard about the boundary case.  I think the subtract 
> overflows but it gets the right answer.

Modulo arithmetic saves your bacon.  In fact that is why the type has to
be unsigned from the C standard point of view.

The only remaining ambiguity is about the initial time of the system,
but as long as the assumption that it is never more than about 70 years
off the true time holds, you never need to care about the NTP era
explicitly…  unless you're still dealing with a 32bit time_t, but the
strategy apparently was that by the time this becomes an issue
everything would have migrated to at least 64bit time_t.  If not, you
could still bound the solution by assuming that ntpd cannot be running
before it has been compiled.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list