The 32-bit integer part of the NTP timestamp overflows in year 2036, which starts the second NTP era.
Modify the timestamp conversion to shift values between 1900-1970 (in the first era) to the second era to enable the client to synchronize correctly until year 2106 (assuming 64-bit time_t). Signed-off-by: Miroslav Lichvar <mlich...@redhat.com> --- networking/ntpd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/networking/ntpd.c b/networking/ntpd.c index 204e1d7c2..d0c61b4bb 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -565,6 +565,9 @@ lfp_to_d(l_fixedpt_t lfp) lfp.int_partl = ntohl(lfp.int_partl); lfp.fractionl = ntohl(lfp.fractionl); ret = (double)lfp.int_partl + ((double)lfp.fractionl / UINT_MAX); + /* Shift timestamps before 1970 to the second NTP era (2036-2106) */ + if (lfp.int_partl < OFFSET_1900_1970) + ret += (double)UINT_MAX + 1.0; return ret; } static NOINLINE double -- 2.35.1 _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox