[Git][NTPsec/ntpsec][master] 4 commits: Correct the date for the WWVB modulation change.

Eric S. Raymond gitlab at mg.gitlab.com
Wed Dec 9 13:29:05 UTC 2015


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
49ed6d8a by Eric S. Raymond at 2015-12-09T08:28:34Z
Correct the date for the WWVB modulation change.

- - - - -
e86a6263 by Eric S. Raymond at 2015-12-09T08:28:34Z
For TESTFRAME, properly intercept calls to set time of day.

Also, make a start on mocking the clock state for replay mode.

- - - - -
fbc77ea3 by Eric S. Raymond at 2015-12-09T08:28:35Z
Reduce default verbosity of capture mode.

- - - - -
538210e3 by Eric S. Raymond at 2015-12-09T08:28:35Z
When mocking time for testframe, store it in NTP format.

- - - - -


12 changed files:

- docs/audio.txt
- docs/driver27.txt
- docs/driver4.txt
- docs/ntpspeak.txt
- docs/refclock.txt
- include/ntp_fp.h
- libntp/systime.c
- ntpd/ntp_intercept.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_timer.c
- ntpd/refclock_spectracom.c
- ntpdig/main.c


Changes:

=====================================
docs/audio.txt
=====================================
--- a/docs/audio.txt
+++ b/docs/audio.txt
@@ -30,14 +30,14 @@ substantially less accurate and less reliably available, for reasons
 ranging from longer atmospheric path to intrinsic jitter in the
 receiving devices.  Reflecting this, no precision time radios have been
 manufactured in the U.S. since NIST's incompatible WWV modulation
-change in 2013.
+change at 2012-10-29T15:00:00Z.
 
 Audio drivers for the NIST time stations WWV and WWVH have already
-been removed from the distribution because they pre-dated the 2013
-modulation change.  The remaining CHU and IRIG drivers are a
-significant maintainence problem, are deprecated, and are likely to be
-removed in a future release unless a significant user constituency for
-them makes itself known.
+been removed from the distribution because they pre-dated the
+2012-10-29T15:00:00Z modulation change.  The remaining CHU and IRIG
+drivers are a significant maintainence problem, are deprecated, and
+are likely to be removed in a future release unless a significant user
+constituency for them makes itself known.
 
 [[sound]]
 == Sound Card Drivers ==
@@ -56,7 +56,8 @@ Inter Range Instrumentation Group (IRIG) signals produced by many
 radio clocks and timing devices, and another for the Canadian
 time/frequency radio station CHU.  There was formerly a third audio
 driver for the NIST time & frequency radio stations WWV and WWVH, but
-it was obsolesced by the 2013 modulation change and has been removed.
+it was obsolesced by the 2012-10-29T15:00:00Z modulation change and
+has been removed.
 
 These drivers make ample use of sophisticated digital signal
 processing algorithms designed to efficiently extract timing signals


=====================================
docs/driver27.txt
=====================================
--- a/docs/driver27.txt
+++ b/docs/driver27.txt
@@ -15,7 +15,7 @@ maintainers plan to remove it in a future release.  If you have a
 requirement for it, please make this known to us.
 
 The "WWVB" functionality of this driver has been inoperable since the
-NIST modulation change in 2013.
+NIST modulation change at 2012-10-29T15:00:00Z.
 
 == Description ==
 


=====================================
docs/driver4.txt
=====================================
--- a/docs/driver4.txt
+++ b/docs/driver4.txt
@@ -16,7 +16,7 @@ servers including the 9483, 9489, and SecureSync.
 
 In former times this driver supported the Spectracom 9300 (now
 end-of-lifed) and several models of Spectracom radio clocks that were
-obsolesced by the WWVB modulation change in 2013.
+obsolesced by the WWVB modulation change at 2012-10-29T15:00:00Z.
 
 There are two timecode formats used by these clocks. Format 0, which is
 available with all clocks, and format 2, which is available with all


=====================================
docs/ntpspeak.txt
=====================================
--- a/docs/ntpspeak.txt
+++ b/docs/ntpspeak.txt
@@ -248,10 +248,11 @@ USNO::
 
 [[WWVB]]
 WWVB::
-  The U.S. national time radio station, run by <<NIST>> and
-  broadcasting a highly accurate U.S. civil-time reference.  Formerly
-  an important primary time source, until NIST changed its modulation
-  in 2013 and obsolesced all then-existing U.S. precision time radios. No
+  http://www.nist.gov/pml/div688/grp40/wwvb.cfm[The U.S. national time
+  radio station], run by <<NIST>> and broadcasting a highly accurate
+  U.S. civil-time reference.  Formerly an important primary time
+  source, until NIST changed its modulation at 2012-10-29T15:00:00Z
+  and obsolesced all then-existing U.S. precision time radios. No
   WWVB-compatible precision time radios have been manufactured since,
   though consumer-grade "atomic clocks" unaffected by the modulation
   change are still made.


=====================================
docs/refclock.txt
=====================================
--- a/docs/refclock.txt
+++ b/docs/refclock.txt
@@ -38,12 +38,13 @@ reference clock use only Coordinated Universal Time (UTC). Timezone and
 standard/daylight adjustments are performed by the operating system
 kernel.
 
-Nowadays a reference clock will generally (though not always) be a GPS or GPSDO
-(GPS-conditioned oscillator). In former times it was often a radio timecode
-receiver synchronized to standard time as provided by NIST and USNO in
-the US, NRC in Canada and their counterparts elsewhere in the world.
-Precision time radios have been extinct in the U.S. since NIST changed their
-signal modulation in 2013; elsewhere they still exist but usage is
+Nowadays a reference clock will generally (though not always) be a GPS
+or GPSDO (GPS-conditioned oscillator). In former times it was often a
+radio timecode receiver synchronized to standard time as provided by
+NIST and USNO in the US, NRC in Canada and their counterparts
+elsewhere in the world.  Precision time radios have been extinct in
+the U.S. since NIST changed their signal modulation at
+2012-10-29T15:00:00Z; elsewhere they still exist but usage is
 declining under pressure from GPS technology.
 
 A device driver specific to each reference clock must be compiled in
@@ -160,8 +161,9 @@ link:copyright.html[Copyright Notice] page.
 
 If you have seen older versions of NTP, this list may have fewer
 entries than you expected.  Support for some very ancient drivers
-(notably, those rendered obsolete by the WWVB modulation change in
-2013) has been dropped in order to reduce our maintainence load.
+(notably, those rendered obsolete by the WWVB modulation change at
+2012-10-29T15:00:00Z) has been dropped in order to reduce our
+maintainence load.
 
 For security reasons, we will no longer support any refclock that requires
 a closed-source driver to run.  This filtered out the


=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -355,7 +355,7 @@ extern	void	init_systime	(void);
 extern  void	get_ostime	(struct timespec *tsp);
 extern	void	normalize_time	(struct timespec, long, l_fp *);
 extern	void	get_systime	(l_fp *);
-extern	bool	step_systime	(double);
+extern	bool	step_systime	(double, int (*settime)(struct timespec *));
 extern	bool	adj_systime	(double, int (*adjtime)(const struct timeval *, struct timeval *));
 
 extern	struct tm * ntp2unix_tm (uint32_t ntp, int local);


=====================================
libntp/systime.c
=====================================
--- a/libntp/systime.c
+++ b/libntp/systime.c
@@ -393,7 +393,8 @@ adj_systime(
 
 bool
 step_systime(
-	double step
+	double step,
+	int (*settime)(struct timespec *)
 	)
 {
 	time_t pivot; /* for ntp era unfolding */
@@ -461,7 +462,7 @@ step_systime(
 	timets = lfp_stamp_to_tspec(fp_sys, &pivot);
 
 	/* now set new system time */
-	if (ntp_set_tod(&timets) != 0) {
+	if (settime(&timets) != 0) {
 		msyslog(LOG_ERR, "step-systime: %m");
 		return false;
 	}


=====================================
ntpd/ntp_intercept.c
=====================================
--- a/ntpd/ntp_intercept.c
+++ b/ntpd/ntp_intercept.c
@@ -22,7 +22,7 @@ following kinds:
 
 8. Calls to adjtime/ntp_adjtime/adjtime to adjust the system clock.
 
-9  Calls to ntp_set_tod to ser the system clock.
+9  Calls to ntp_set_tod to set the system clock.
 
 10. Read of the system leapsecond file.
 
@@ -72,6 +72,13 @@ terminate - the replay failed.  Otherwise continue.
 Replay succeeds if the event stream reaches the shutdown event with
 no mismatches.
 
+== Limitations ==
+
+Replay mode has to not require root privileges and not actually change
+the timekeeping state of the machine.  Therefore it mocks the state of the
+system clock with static storage.  Bug: the state of the PLL is not yet
+mocked.
+
 *****************************************************************************/
 
 #include <time.h>
@@ -104,6 +111,9 @@ no mismatches.
 
 static intercept_mode mode = none;
 
+/* mock the clock state */
+static l_fp replay_time;
+
 intercept_mode intercept_get_mode(void)
 {
     return mode;
@@ -118,7 +128,8 @@ void intercept_set_mode(intercept_mode newmode)
 	else if (mode == capture)
 	    fputs("# Setting capture mode\n", stdout);
 	syslogit = false;
-	hashprefix = termlogit = true;
+	//hashprefix = termlogit = true;
+	termlogit = false;
     }
 }
 
@@ -164,7 +175,6 @@ static bool pump(const char *fn, const char *lead, const char *trail, FILE *ofp)
 
 void intercept_getconfig(const char *configfile)
 {
-    printf("CONFIG %s\n", configfile);
     if (mode != replay)
 	getconfig(configfile);
 
@@ -189,13 +199,17 @@ void intercept_log(const char *fmt, ...)
 void intercept_get_systime(const char *legend, l_fp *now)
 {
     struct timespec ts;	/* seconds and nanoseconds */
-    get_ostime(&ts);
 
-    if (mode == capture)
-	printf("event systime %s %ld %ld\n",
-		legend, (long)ts.tv_sec, ts.tv_nsec);
+    if (mode == replay) {
+	*now = replay_time;
+    } else {
+	get_ostime(&ts);
+	normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
+    }
+
+    if (mode != none)
+	printf("event systime %s %s\n", legend, lfptoa(now, 10));
 
-    normalize_time(ts, sys_fuzz > 0.0 ? ntp_random() : 0, now);
 }
 
 long intercept_ntp_random(const char *legend)
@@ -330,10 +344,10 @@ int intercept_set_tod(struct timespec *tvs)
     if (mode != none)
 	printf("event set_tod %ld %ld\n", tvs->tv_sec, tvs->tv_nsec);
 
-    if (mode != replay)
+    if (mode == replay)
 	return ntp_set_tod(tvs);
 
-    /* dodgy - returning success despite not setting time */
+    normalize_time(*tvs, 9, &replay_time);
     return 0;
 }
 


=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -496,7 +496,7 @@ local_clock(
 	if (mode_ntpdate) {
 		if (  ( fp_offset > clock_max_fwd  && clock_max_fwd  > 0)
 		   || (-fp_offset > clock_max_back && clock_max_back > 0)) {
-			step_systime(fp_offset);
+			step_systime(fp_offset, intercept_set_tod);
 			msyslog(LOG_NOTICE, "ntpd: time set %+.6f s",
 			    fp_offset);
 			printf("ntpd: time set %+.6fs\n", fp_offset);
@@ -629,7 +629,7 @@ local_clock(
 			snprintf(tbuf, sizeof(tbuf), "%+.6f s",
 			    fp_offset);
 			report_event(EVNT_CLOCKRESET, NULL, tbuf);
-			step_systime(fp_offset);
+			step_systime(fp_offset, intercept_set_tod);
 			if (intercept_get_mode() != replay)
 			    reinit_timer();
 			tc_counter = 0;


=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -585,7 +585,7 @@ check_leapsec(
 			if (lsdata.warped < 0) {
 				if (clock_max_back > 0.0 &&
 				    clock_max_back < abs(lsdata.warped)) {
-					step_systime(lsdata.warped);
+					step_systime(lsdata.warped, intercept_set_tod);
 					leapmsg = leapmsg_p_step;
 				} else {
 					leapmsg = leapmsg_p_slew;
@@ -593,7 +593,7 @@ check_leapsec(
 			} else 	if (lsdata.warped > 0) {
 				if (clock_max_fwd > 0.0 &&
 				    clock_max_fwd < abs(lsdata.warped)) {
-					step_systime(lsdata.warped);
+					step_systime(lsdata.warped, intercept_set_tod);
 					leapmsg = leapmsg_n_step;
 				} else {
 					leapmsg = leapmsg_n_slew;


=====================================
ntpd/refclock_spectracom.c
=====================================
--- a/ntpd/refclock_spectracom.c
+++ b/ntpd/refclock_spectracom.c
@@ -25,7 +25,7 @@
  *
  * In former times this driver supported the Spectracom 9300 (now
  * end-of-lifed) and several models of Spectracom radio clocks that were
- * obsolesced by the WWVB modulation change in 2013.
+ * obsolesced by the WWVB modulation change at 2012-10-29T15:00:00Z.
  *
  * There are two timecode formats used by these clocks:
  *


=====================================
ntpdig/main.c
=====================================
--- a/ntpdig/main.c
+++ b/ntpdig/main.c
@@ -1555,7 +1555,7 @@ set_time(
 	    (   !opt_slew
 	     || (opt_slew && (fabs(offset) > steplimit))
 	    )) {
-		rc = step_systime(offset);
+		rc = step_systime(offset, ntp_set_tod);
 
 		/* If there was a problem, can we rely on errno? */
 		if (1 == rc)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/9970a8b739c380be8826988a44e0ab5089840124...538210e32128eedc2bc78c90b0a6706d263feffe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151209/875e5845/attachment.html>


More information about the vc mailing list