[Toybox] [PATCH] sntp.c: fix 32-bit.
Rob Landley
rob at landley.net
Fri Jan 10 20:46:40 PST 2020
On 1/10/20 4:31 PM, enh via Toybox wrote:
> The epoch was being defined as UL, which is fine for LP64, but too small
> on LP32 for what we're trying to do.
>
> toys/net/sntp.c:60:32: warning: left shift count >= width of type
> return ((tv.tv_sec+SEVENTIES)<<32)+(((long long)tv.tv_nsec)<<32)/1000000000;
Sigh, applied.
I note that:
// Y2036 fixup: if time wrapped, it's in the future
tv->tv_sec = (now>>32) + (1LL<<32)*!(now&(1LL<<63));
Means we've got another century of sntp working for us, by the way. :)
Rob
More information about the Toybox
mailing list