components/ntp/patches/70-leapslew.patch
branchs11u2-sru
changeset 4215 c0c7615b4511
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ntp/patches/70-leapslew.patch	Wed Apr 29 12:54:24 2015 -0700
@@ -0,0 +1,42 @@
+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;