Hi Paul, > > diff --git a/lib/xtime.h b/lib/xtime.h > > index 77f1c30..5e0ae89 100644 > > --- a/lib/xtime.h > > +++ b/lib/xtime.h > > @@ -42,12 +42,13 @@ extern "C" { > > XTIME_INLINE xtime_t > > xtime_make (xtime_t s, long int ns) > > { > > - const long int giga = 1000 * 1000 * 1000; > > - s += ns / giga; > > - ns %= giga; > > return XTIME_PRECISION * s + ns; > > } > > Akim put in that code in October 2018, but I can't see the need for it either.
It was surely needed before the simplification of commit "gethrxtime: Assume that the compiler supports 'long long'." that I did earlier today. > > xtime_sec (xtime_t t) > > { > > return (t < 0 > > - ? (t + XTIME_PRECISION - 1) / XTIME_PRECISION - 1 > > + ? (t + 1) / XTIME_PRECISION - 1 > > : xtime_nonnegative_sec (t)); > > Thanks for pointing out the bug. We can simplify the fix further (and speed it > up a bit on typical hosts). I installed the second attached patch to do that. Thanks! I confirm that the new formula is correct. Bruno