From: Miroslav Lichvar Date: Thu, 2 May 2024 11:20:54 +0000 (+0200) Subject: reference: switch is_leap_close() from time_t to double X-Git-Tag: 4.6-pre1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adaca0ff19308f2bb2c0e2eb3247ea778bfe6549;p=thirdparty%2Fchrony.git reference: switch is_leap_close() from time_t to double Avoid undefined behavior in the timestamp conversion from double to time_t in REF_IsLeapSecondClose() with NTP sources configured with a large offset correction. --- diff --git a/reference.c b/reference.c index ffe290c9..009d7c98 100644 --- a/reference.c +++ b/reference.c @@ -1291,7 +1291,7 @@ REF_DisableLocal(void) #define LEAP_SECOND_CLOSE 5 static int -is_leap_close(time_t t) +is_leap_close(double t) { return leap_when != 0 && t >= leap_when - LEAP_SECOND_CLOSE && t < leap_when + LEAP_SECOND_CLOSE;