[Bug 16264] NTP server t2 and t3 timestamps give bogus results
bugzilla at busybox.net
bugzilla at busybox.net
Sat Dec 7 23:15:36 UTC 2024
https://bugs.busybox.net/show_bug.cgi?id=16264
--- Comment #2 from Bert Broekhuizen <bert.broekhuizen at kpnmail.nl> ---
Further analysis shows that the issue is in the following code:
static NOINLINE void
d_to_lfp(l_fixedpt_t *lfp, double d)
{
uint32_t intl;
uint32_t frac;
intl = (uint32_t)(time_t)d;
frac = (uint32_t)((d - (time_t)d) * 0xffffffff);
lfp->int_partl = htonl(intl);
lfp->fractionl = htonl(frac);
}
The added (time_t) casts are problematic on 32-bit systems where time_t is
defined as long and where long is a 32-bit signed integer.
(time_t)d results in 0x7fffffff on those systems and that explains the bad
results for t2 and t3.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list