components/ntp/patches/70-leapslew.patch
author Girish Moodalbail <Girish.Moodalbail@oracle.COM>
Tue, 02 Jun 2015 12:43:22 -0600
changeset 4389 a44bb9a2917e
parent 4185 65ec845ad48f
permissions -rw-r--r--
21086485 neutron-l3-agent service should not report online if trace dump happened 21157386 dhcp & metadata agents trace dump due to report state failure

This patch can be removed when upgrading to community version that has
NTP bug 2745 fixed. See http://bugzilla.ntp.org/show_bug.cgi?id=2745

--- ntpd/ntp_timer.c
+++ 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,23 @@ 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 slowdown slew soon."
+				    " System clock will be inaccurate until it finishes.");
+			}
 		} 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 speedup slew soon."
+				    " System clock will be inaccurate until it finishes.");
+			}
 		}
 		report_event(EVNT_LEAP, NULL, NULL);
 		lsprox  = LSPROX_NOWARN;