From: Dave Hart Date: Sun, 11 Mar 2012 07:10:54 +0000 (+0000) Subject: [Bug 2159] Windows ntpd using leapfile erroneous leap second 20120401. X-Git-Tag: NTP_4_2_7P263~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=068b023b72518907a4f6a5042d022f668b9f3d60;p=thirdparty%2Fntp.git [Bug 2159] Windows ntpd using leapfile erroneous leap second 20120401. bk: 4f5c4ffekezHkt9-OZ3J1RtkReJ1-w --- diff --git a/ChangeLog b/ChangeLog index 29b6f552c..835d42399 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ * [Bug 2156] clock instability with LOCAL driver, from Miroslav Lichvar. +* [Bug 2159] Windows ntpd using leapfile erroneous leap second 20120401. (4.2.7p262) 2012/02/29 Released by Harlan Stenn * Improve ntpd scalability for servers with many trusted keys. (4.2.7p261) 2012/02/27 Released by Harlan Stenn diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h index 0640dae2d..4f31c9d3a 100644 --- a/include/ntp_stdlib.h +++ b/include/ntp_stdlib.h @@ -77,6 +77,10 @@ extern void errno_to_str(int, char *, size_t); errno = preserved_errno; \ } +#define MINUTE 60 +#define HOUR (60 * MINUTE) +#define DAY (24 * HOUR) + typedef void (*ctrl_c_fn)(void); /* authkeys.c */ diff --git a/ntpd/ntp_timer.c b/ntpd/ntp_timer.c index 1afd12eeb..c853aac9a 100644 --- a/ntpd/ntp_timer.c +++ b/ntpd/ntp_timer.c @@ -78,10 +78,6 @@ u_long sys_automax = NTP_AUTOMAX; /* key list timeout (log2 s) */ */ volatile u_long alarm_overflow; -#define MINUTE 60 -#define HOUR (60 * MINUTE) -#define DAY (24 * HOUR) - u_long current_time; /* seconds since startup */ /* diff --git a/ports/winnt/ntpd/nt_clockstuff.c b/ports/winnt/ntpd/nt_clockstuff.c index 1e1efd7fd..f52d0e1fb 100644 --- a/ports/winnt/ntpd/nt_clockstuff.c +++ b/ports/winnt/ntpd/nt_clockstuff.c @@ -472,10 +472,11 @@ adj_systime( /* - * If a leap second is pending then determine the UTC time stamp - * of when the insertion must take place + * If a leap second is pending for the end of the month, + * determine the UTC time stamp when the insertion must take + * place */ - if (leapsec > 0) { + if (0 < leapsec && leapsec < 31 * DAY) { if (0 == ls_ft.ull) { /* time stamp has not yet been computed */ GetSystemTime(&st);