From: Juergen Perlinger Date: Tue, 21 Apr 2015 19:08:11 +0000 (+0200) Subject: [Bug 2745] ntpd -x steps clock on leap second X-Git-Tag: NTP_4_3_24~1^2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47c9f6c9030193714c337c5c128bba86c2535fa6;p=thirdparty%2Fntp.git [Bug 2745] ntpd -x steps clock on leap second Do leap second stepping only of the step adjustment is beyond the proper jump distance limit and step correction is allowed at all. bk: 5536a01bsP24qMk41nIZEUlK9FTYJw --- diff --git a/ChangeLog b/ChangeLog index de60ac5a8..0873beb0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ --- +* [Bug 2745] ntpd -x steps clock on leap second + Do leap second stepping only of the step adjustment is beyond the + proper jump distance limit and step correction is allowed at all. * [Bug 2794] Clean up kernel clock status reports. * [Bug 2804] install-local-data assumes GNU 'find' semantics. * [Bug 2808] GPSD_JSON driver enhancements, step 1. diff --git a/ntpd/ntp_timer.c b/ntpd/ntp_timer.c index 958c8db39..cc7e9ef1a 100644 --- a/ntpd/ntp_timer.c +++ b/ntpd/ntp_timer.c @@ -472,7 +472,7 @@ alarming( # endif # ifdef DEBUG if (debug >= 4) - write(1, msg, strlen(msg)); + (void)(0 != write(1, msg, strlen(msg))); # endif } #endif /* SYS_WINNT */ @@ -521,11 +521,21 @@ check_leapsec( * announce the leap event has happened. */ if (lsdata.warped < 0) { - step_systime(lsdata.warped); - msyslog(LOG_NOTICE, "Inserting positive leap second."); + if (clock_max_back > 0.0 && + clock_max_back < fabs(lsdata.warped)) { + step_systime(lsdata.warped); + msyslog(LOG_NOTICE, "Positive leap second, stepped backward."); + } else { + msyslog(LOG_NOTICE, "Positive leap second, expect heavy slowdown slew."); + } } else if (lsdata.warped > 0) { - step_systime(lsdata.warped); - msyslog(LOG_NOTICE, "Inserting negative leap second."); + if (clock_max_fwd > 0.0 && + clock_max_fwd < fabs(lsdata.warped)) { + step_systime(lsdata.warped); + msyslog(LOG_NOTICE, "Negative leap second, stepped forward."); + } else { + msyslog(LOG_NOTICE, "Negative leap second, expect heavy speedup slew."); + } } report_event(EVNT_LEAP, NULL, NULL); lsprox = LSPROX_NOWARN;