[Git][NTPsec/ntpsec][master] 4 commits: Remove settime arg to step_systime, drop set_tod from python

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Fri Feb 4 00:37:29 UTC 2022



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
6f764991 by Hal Murray at 2022-01-22T23:00:42-08:00
Remove settime arg to step_systime, drop set_tod from python

- - - - -
1cf0ea00 by Hal Murray at 2022-01-29T23:19:05-08:00
Add PIVOT.h, use it in ntp_calendar, prettydate and refclock_nmea

- - - - -
f4b1a199 by Hal Murray at 2022-01-30T01:31:30-08:00
More tweaks to HOWTO-OpenSSL

- - - - -
bad4145c by Hal Murray at 2022-01-30T01:32:22-08:00
Rename day to yday in struct refclockproc and 9 refclock drivers

- - - - -


27 changed files:

- HOWTO-OpenSSL
- + PIVOT.h
- + include/PIVOT.h
- include/ntp_fp.h
- include/ntp_refclock.h
- libntp/ntp_c.c
- libntp/ntp_calendar.c
- libntp/prettydate.c
- libntp/pymodule.c
- libntp/systime.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_refclock.c
- ntpd/ntp_timer.c
- ntpd/ntpd.c
- ntpd/refclock_arbiter.c
- ntpd/refclock_hpgps.c
- ntpd/refclock_jjy.c
- ntpd/refclock_modem.c
- ntpd/refclock_nmea.c
- ntpd/refclock_oncore.c
- ntpd/refclock_spectracom.c
- ntpd/refclock_trimble.c
- ntpd/refclock_truetime.c
- ntpd/refclock_zyfer.c
- pylib/ntpc.py
- tests/libntp/prettydate.c
- tests/pylib/test_util.py


Changes:

=====================================
HOWTO-OpenSSL
=====================================
@@ -2,8 +2,8 @@ NTS needs TLS 1.3 or newer.
 That was first supported in OpenSSL 1.1.1
   (1.1.1a is broken)
 Some OSes/Distros don't support a new enough version of OpenSSL
-This file contains notes on how to download, build, and install 1.1.1k
-It also works for testing 3.0.0 beta
+This file contains notes on how to download, build, and install 1.1.1m
+It also works for testing 3.0.1
 
 It's rough.  Don't be surprised by bugs/oversights.
 Corrections, clarifications and feedback encouraged.
@@ -18,19 +18,19 @@ But check for the latest versions first.
 cd xxx
 mkdir OpenSSL
 cd OpenSSL
-for OpenSSL 1.1.1k
-  wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
-  tar -xzf openssl-1.1.1k.tar.gz
-  cd openssl-1.1.1k
-for OpenSSL 3.0.0 beta2
-  wget https://www.openssl.org/source/openssl-3.0.0-beta2.tar.gz
-  tar -xzf openssl-3.0.0-beta2.tar.gz
-  cd openssl-3.0.0-beta2
+for OpenSSL 1.1.1m
+  wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz
+  tar -xzf openssl-1.1.1m.tar.gz
+  cd openssl-1.1.1m
+for OpenSSL 3.0.1
+  wget https://www.openssl.org/source/openssl-3.0.1.tar.gz
+  tar -xzf openssl-3.0.1.tar.gz
+  cd openssl-3.0.1
 
 # Check NOTES.PERL
 #   for CentOS, you need
   sudo yum install perl-core
-# Fedora 33+34 for 3.0.0-alpha and beta
+# Fedora 35 for 3.0.1
   # ./config needs
   sudo dnf install perl-FindBin 'perl(IPC::Cmd)' 'perl(File::Compare)'
   # make needs
@@ -38,12 +38,15 @@ for OpenSSL 3.0.0 beta2
   sudo dnf install 'perl(Test::Harness)' 'perl(Test::More)' 'perl(File::Copy)'
   # make install also needs:
   sudo dnf install 'perl(Pod::Html)'
-# On FreeBSD for 3.0.0-alpha and beta
+# On FreeBSD for 3.0.1
   sudo pkg install perl5
 
 On Linux
-  ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared
-	enable-des
+  openssl version -d
+  OPENSSLDIR=`openssl version -d | sed "s/OPENSSLDIR: //"`
+  OPENSSLDIR=`echo $OPENSSLDIR | sed s/\"//g`
+  echo $OPENSSLDIR
+  ./Configure --prefix=/usr/local/ssl --openssldir=$OPENSSLDIR shared
 
 ***   If you encounter a problem while building, please open an    ***
 ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
@@ -52,17 +55,19 @@ On Linux
 ***       perl configdata.pm --dump                                ***
 
 time make -j4
+  # Check that we got it right.  These should match.
+  openssl version -d
+  util/shlib_wrap.sh ./apps/openssl version -d
+  # ./apps/openssl without the wrapper will use the installed libraries
 time make test
-time make build_docs
+time make build_docs  # doesn't work on 1.1.1
 sudo make install
 
 sudo su
   cd /etc/ld.so.conf.d
-  echo "/usr/local/ssl/lib" > openssl-1.1.1k.conf
-  ## NB: beta2 changed from lib to lib64
-  ## If you have tested with alpha or beta1,
-  ## you need to fix beta.conf and remove alpha.conf
-  echo "/usr/local/ssl/lib64" > openssl-3.0.0-beta.conf
+  echo "/usr/local/ssl/lib" > openssl-1.1.1m.conf
+  echo "/usr/local/ssl/lib" > openssl-3.0.1.conf    # 32 bit systems
+  echo "/usr/local/ssl/lib64" > openssl-3.0.1.conf  # 64 bit systems
   # running ldconfig before install doesn't work
   ldconfig
 
@@ -83,6 +88,10 @@ NetBSD:
 # match where wscript looks for your OS.
 # The above works for CentOS 7
 
-Fedora and CentOS 7 need this if you use real certificates:
+----------
+
+On earlier versions of the Configure step (above)
+Fedora and CentOS 7 needed this if you use real certificates:
   nts ca /etc/pki/tls/certs/ca-bundle.trust.crt
+It works correctly now.
 


=====================================
PIVOT.h
=====================================
@@ -0,0 +1,12 @@
+#define RELEASE_DATE 1642909320
+
+/* We would like to use the build date.
+ * But that breaks repeatable builds.
+
+ * Update this before each release.
+ * Some tests may need to be updated.
+ * So when the release is announced is a good time.
+
+ * Get the magic number from "date +%s"
+
+ */


=====================================
include/PIVOT.h
=====================================
@@ -0,0 +1 @@
+../PIVOT.h
\ No newline at end of file


=====================================
include/ntp_fp.h
=====================================
@@ -150,7 +150,6 @@ extern	char *	mfptoa		(l_fp, short);
 extern	char *	mfptoms		(l_fp, short);
 
 extern	bool	hextolfp	(const char *, l_fp *);
-extern	void	set_prettydate_pivot(time_t);
 extern	char *	prettydate	(const l_fp);
 extern	char *	rfc3339date	(const l_fp);
 extern	char *	rfc3339time     (time_t);
@@ -159,7 +158,7 @@ extern	char *	rfc3339time     (time_t);
 extern	void	set_sys_fuzz	(double);
 #endif
 extern	void	get_systime	(l_fp *);
-extern	bool	step_systime	(doubletime_t, int (*settime)(struct timespec *));
+extern	bool	step_systime	(doubletime_t);
 extern	bool	adj_systime	(double, int (*adjtime)(const struct timeval *, struct timeval *));
 
 #define	lfptoa(fpv, ndec)	mfptoa((fpv), (ndec))


=====================================
include/ntp_refclock.h
=====================================
@@ -116,7 +116,7 @@ struct refclockproc {
 	int	lencode;	/* length of last timecode */
 
 	int	year;		/* year of eternity */
-	int	day;		/* day of year */
+	int	yday;		/* day of year */
 	int	hour;		/* hour of day */
 	int	minute;		/* minute of hour */
 	int	second;		/* second of minute */


=====================================
libntp/ntp_c.c
=====================================
@@ -28,7 +28,6 @@
 void ntpc_setprogname(char*);
 char *ntpc_prettydate(char*);
 double ntpc_lfptofloat(char*);
-int ntpc_set_tod(int, int);
 bool ntpc_adj_systime(double);
 bool ntpc_step_systime(double);
 
@@ -88,16 +87,6 @@ ntpc_lfptofloat(char *s)
 	return tt.tv_sec + (tt.tv_nsec * S_PER_NS);
 }
 
-int
-ntpc_set_tod(int seconds, int fractional)
-{
-	struct timespec ts;
-	ts.tv_sec = seconds;
-	ts.tv_nsec = fractional;
-
-	return ntp_set_tod(&ts);
-}
-
 bool
 ntpc_adj_systime(double adjustment)
 {
@@ -116,5 +105,5 @@ ntpc_step_systime(double adjustment)
 	 * and now exceeds the range of a double.
 	 */
 	full_adjustment = adjustment;
-	return step_systime(full_adjustment, ntp_set_tod);
+	return step_systime(full_adjustment);
 }


=====================================
libntp/ntp_calendar.c
=====================================
@@ -15,6 +15,7 @@
 #include "ntp_calendar.h"
 #include "ntp_stdlib.h"
 #include "ntp_fp.h"
+#include "PIVOT.h"
 
 /*
  *---------------------------------------------------------------------
@@ -38,7 +39,7 @@ ntpcal_get_build_date(
 	struct calendar * jd
 	)
 {
-        time_t epoch = (time_t)1577836800; // 2020 Jan 01 -> 1863820800 - 2029 Jan 23
+        time_t epoch = RELEASE_DATE;
         struct tm epoch_tm;
 
 	ZERO(*jd);


=====================================
libntp/prettydate.c
=====================================
@@ -9,6 +9,7 @@
 #include "lib_strbuf.h"
 #include "ntp_stdlib.h"
 #include "ntp_calendar.h"
+#include "PIVOT.h"
 
 #if NTP_SIZEOF_TIME_T < 4
 # error sizeof(time_t) < 4 -- this will not work!
@@ -114,13 +115,6 @@ get_struct_tm(
 	return tm;
 }
 
-static time_t prettypivot;
-
-void
-set_prettydate_pivot(time_t pivot) {
-    prettypivot = pivot;
-}
-
 static char *
 common_prettydate(
 	const l_fp ts
@@ -144,7 +138,7 @@ common_prettydate(
 		msec -= 1000U;
 		ntps++;
 	}
-	sec = ntpcal_ntp_to_time(ntps, prettypivot);
+	sec = ntpcal_ntp_to_time(ntps, RELEASE_DATE);
 	tm  = get_struct_tm(&sec, &tmbuf);
 	if (!tm) {
 		/*


=====================================
libntp/pymodule.c
=====================================
@@ -109,17 +109,6 @@ ntpc_lfptofloat(PyObject *self, PyObject *args)
 	return Py_BuildValue("d", tt.tv_sec + tt.tv_nsec * S_PER_NS);
 }
 
-static PyObject *
-ntpc_set_tod(PyObject *self, PyObject *args)
-{
-	struct timespec ts;
-
-	UNUSED_ARG(self);
-	if (!PyArg_ParseTuple(args, "ii", &ts.tv_sec, &ts.tv_nsec))
-		return NULL;
-	return Py_BuildValue("d", ntp_set_tod(&ts));
-}
-
 static PyObject *
 ntpc_adj_systime(PyObject *self, PyObject *args)
 {
@@ -147,7 +136,7 @@ ntpc_step_systime(PyObject *self, PyObject *args)
 	if (!PyArg_ParseTuple(args, "d", &adjustment))
 		return NULL;
 	full_adjustment = adjustment;
-	return Py_BuildValue("d", step_systime(full_adjustment, ntp_set_tod));
+	return Py_BuildValue("d", step_systime(full_adjustment));
 }
 
 /* --------------------------------------------------------------- */


=====================================
libntp/systime.c
=====================================
@@ -331,8 +331,7 @@ adj_systime(
 
 bool
 step_systime(
-	doubletime_t step,
-	int (*settime)(struct timespec *)
+	doubletime_t step
 	)
 {
 	time_t pivot; /* for ntp era unfolding */
@@ -402,7 +401,7 @@ step_systime(
 	new = timets;
 
 	/* now set new system time */
-	if (settime(&timets) != 0) {
+	if (ntp_set_tod(&timets) != 0) {
 		msyslog(LOG_ERR, "CLOCK: step_systime: %s", strerror(errno));
 		return false;
 	}


=====================================
ntpd/ntp_loopfilter.c
=====================================
@@ -480,7 +480,7 @@ local_clock(
 	if (clock_ctl.mode_ntpdate) {
 		if (  ( fp_offset > loop_data.clock_max_fwd  && loop_data.clock_max_fwd  > 0)
 		   || (-fp_offset > loop_data.clock_max_back && loop_data.clock_max_back > 0)) {
-			step_systime(fp_offset, ntp_set_tod);
+			step_systime(fp_offset);
 			msyslog(LOG_NOTICE, "CLOCK: time set %+.6f s",
 			    fp_offset);
 			printf("ntpd: time set %+.6fs\n", fp_offset);
@@ -611,7 +611,7 @@ local_clock(
 			snprintf(tbuf, sizeof(tbuf), "%+.6f s",
 			    fp_offset);
 			report_event(EVNT_CLOCKRESET, NULL, tbuf);
-			step_systime(fp_offset, ntp_set_tod);
+			step_systime(fp_offset);
 			reinit_timer();
 			clkstate.tc_counter = 0;
 			clkstate.clock_jitter = LOGTOD(sys_vars.sys_precision);


=====================================
ntpd/ntp_refclock.c
=====================================
@@ -406,7 +406,7 @@ refclock_process_f(
 	 * to deducing the year from the receipt time of the sample if
 	 * it finds only a 2-digit year in the timecode.
 	 */
-	if (!clocktime(pp->year, pp->day, pp->hour, pp->minute, pp->second,
+	if (!clocktime(pp->year, pp->yday, pp->hour, pp->minute, pp->second,
 		       time(NULL), lfpuint(pp->lastrec), &pp->yearstart, &sec)) {
 		return false;
 	}


=====================================
ntpd/ntp_timer.c
=====================================
@@ -453,7 +453,7 @@ check_leapsec(
 			if (lsdata.warped < 0) {
 				if (loop_data.clock_max_back > 0.0 &&
 				    loop_data.clock_max_back < abs(lsdata.warped)) {
-					step_systime(lsdata.warped, ntp_set_tod);
+					step_systime(lsdata.warped);
 					leapmsg = leapmsg_p_step;
 				} else {
 					leapmsg = leapmsg_p_slew;
@@ -461,7 +461,7 @@ check_leapsec(
 			} else 	if (lsdata.warped > 0) {
 				if (loop_data.clock_max_fwd > 0.0 &&
 				    loop_data.clock_max_fwd < abs(lsdata.warped)) {
-					step_systime(lsdata.warped, ntp_set_tod);
+					step_systime(lsdata.warped);
 					leapmsg = leapmsg_n_step;
 				} else {
 					leapmsg = leapmsg_n_slew;


=====================================
ntpd/ntpd.c
=====================================
@@ -530,8 +530,6 @@ main(
 		exit(1);
 	}
 
-	set_prettydate_pivot(time(NULL));
-
 	/* make sure the FDs are initialised */
 	pipe_fds[0] = -1;
 	pipe_fds[1] = -1;


=====================================
ntpd/refclock_arbiter.c
=====================================
@@ -316,7 +316,7 @@ arb_receive(
 	pp->lencode = (int)strlen(pp->a_lastcode);
 	syncchar = ' ';
 	if (sscanf(pp->a_lastcode, "%c%2d %3d %2d:%2d:%2d",
-	    &syncchar, &pp->year, &pp->day, &pp->hour,
+	    &syncchar, &pp->year, &pp->yday, &pp->hour,
 	    &pp->minute, &pp->second) != 6) {
 		refclock_report(peer, CEVNT_BADREPLY);
 		IGNORE(write(pp->io.fd, COMMAND_HALT_BCAST, 2));


=====================================
ntpd/refclock_hpgps.c
=====================================
@@ -485,7 +485,7 @@ hpgps_receive(
 		}
 	}
 
-	pp->day = day;
+	pp->yday = day;
 
 	/*
 	 * Decode the MFLRV indicators.


=====================================
ntpd/refclock_jjy.c
=====================================
@@ -939,7 +939,7 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 	const char	*pStatus ;
 
 	pp->year   = up->year ;
-	pp->day    = ymd2yd( up->year, up->month, up->day ) ;
+	pp->yday   = ymd2yd( up->year, up->month, up->day ) ;
 	pp->hour   = up->hour ;
 	pp->minute = up->minute ;
 	pp->second = up->second ;
@@ -951,10 +951,10 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 	pp->hour -= 9 ;
 	if ( pp->hour < 0 ) {
 		pp->hour += 24 ;
-		pp->day -- ;
-		if ( pp->day < 1 ) {
+		pp->yday -- ;
+		if ( pp->yday < 1 ) {
 			pp->year -- ;
-			pp->day  = ymd2yd( pp->year, 12, 31 ) ;
+			pp->yday  = ymd2yd( pp->year, 12, 31 ) ;
 		}
 	}
 
@@ -979,7 +979,7 @@ jjy_synctime ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 		   "%04d/%02d/%02d %02d:%02d:%02d.%03d JST   ( %04d/%03d %02d:%02d:%02d.%03d UTC )",
 		   up->year, up->month, up->day,
 		   up->hour, up->minute, up->second, up->msecond,
-		   pp->year, pp->day, pp->hour, pp->minute, pp->second,
+		   pp->year, pp->yday, pp->hour, pp->minute, pp->second,
 		   (int)(pp->nsec/1000000) ) ;
 	jjy_write_clockstats( peer, JJY_CLOCKSTATS_MARK_ATTENTION, sLog ) ;
 


=====================================
ntpd/refclock_modem.c
=====================================
@@ -795,7 +795,7 @@ modem_timecode(
 			refclock_report(peer, CEVNT_BADREPLY);
 			return;
 		}
-		pp->day = ymd2yd(pp->year, month, day);
+		pp->yday = ymd2yd(pp->year, month, day);
 		pp->leap = LEAP_NOWARNING;
 		if (leap == 1)
 			pp->leap = LEAP_ADDSECOND;
@@ -815,7 +815,7 @@ modem_timecode(
 	 */
 	case LENUSNO:
 		if (sscanf(str, "%5lu %3d %2d%2d%2d %3s",
-		    &mjd, &pp->day, &pp->hour, &pp->minute,
+		    &mjd, &pp->yday, &pp->hour, &pp->minute,
 		    &pp->second, utc) != 6) {
 			refclock_report(peer, CEVNT_BADREPLY);
 			return;
@@ -851,7 +851,7 @@ modem_timecode(
 			else if (leapdir == '-')
 				pp->leap = LEAP_DELSECOND;
 		}
-		pp->day = ymd2yd(pp->year, month, day);
+		pp->yday = ymd2yd(pp->year, month, day);
 		memcpy(&pp->refid, REFPTB, REFIDLEN);
 		peer->sstclktype = CTL_SST_TS_TELEPHONE;
 		up->msgcnt++;
@@ -863,7 +863,7 @@ modem_timecode(
 	 */
 	case LENTYPE0:
 		if (sscanf(str, "%c %3d %2d:%2d:%2d %cTZ=%2d",
-		    &synchar, &pp->day, &pp->hour, &pp->minute,
+		    &synchar, &pp->yday, &pp->hour, &pp->minute,
 		    &pp->second, &dstchar, &tz) != 7) {
 			refclock_report(peer, CEVNT_BADREPLY);
 			return;
@@ -881,7 +881,7 @@ modem_timecode(
 	 */
 	case LENTYPE2:
 		if (sscanf(str, "%c%c%2d %3d %2d:%2d:%2d.%3ld%c%c%c",
-		    &synchar, &qualchar, &pp->year, &pp->day,
+		    &synchar, &qualchar, &pp->year, &pp->yday,
 		    &pp->hour, &pp->minute, &pp->second, &pp->nsec,
 		    &dstchar, &leapchar, &dstchar) != 11) {
 			refclock_report(peer, CEVNT_BADREPLY);


=====================================
ntpd/refclock_nmea.c
=====================================
@@ -31,6 +31,7 @@
 #include "ntp_refclock.h"
 #include "ntp_stdlib.h"
 #include "timespecops.h"
+#include "PIVOT.h"
 
 #ifdef HAVE_PPSAPI
 # include "ppsapi_timepps.h"
@@ -1678,10 +1679,6 @@ static bool kludge_day (struct timespec *dt) {
   return true;
 }
 
-/* FIXME move this to a better place */
-/* Get this from date +%s */
-#define GPS_PIVOT 1642417438
-
 /* Early GPS has a 10 bit week number field.
  * That's a bit less than 20 years.
  * GPS started in 1980.  We have now wrapped twice: Aug 1999 and Apr 2019.
@@ -1703,7 +1700,7 @@ static bool kludge_day (struct timespec *dt) {
 
 static bool fix_WNRO (struct timespec *dt, int *wnro, const struct peer *peer) {
   int i;
-  for (i=0; dt->tv_sec < GPS_PIVOT; i++) {
+  for (i=0; dt->tv_sec < RELEASE_DATE; i++) {
     dt->tv_sec += 1024*7*86400;
   }
   if (*wnro != i) {


=====================================
ntpd/refclock_oncore.c
=====================================
@@ -1817,7 +1817,7 @@ oncore_get_timestamp(
 		snprintf(Msg, sizeof(Msg),	/* MAX length 128, currently at 127 */
  "%u.%09lu %d %d %2d %2d %2d %2ld rstat   %02x dop %4.1f nsat %2d,%d traim %d,%s,%s sigma %s neg-sawtooth %s sat %d%d%d%d%d%d%d%d",
 		    lfpuint(ts), j,
-		    instance->pp->year, instance->pp->day,
+		    instance->pp->year, instance->pp->yday,
 		    instance->pp->hour, instance->pp->minute,
                     instance->pp->second,
 		    (long) tsp->tv_sec % 60,
@@ -1855,7 +1855,7 @@ oncore_get_timestamp(
 		snprintf(Msg, sizeof(Msg),
  "%u.%09lu %d %d %2d %2d %2d %2ld rstat %02x dop %4.1f nsat %2d,%d traim %d,%s,%s sigma %s neg-sawtooth %s sat %d%d%d%d%d%d%d%d%d%d%d%d",
 		    lfpuint(ts), j,
-		    instance->pp->year, instance->pp->day,
+		    instance->pp->year, instance->pp->yday,
 		    instance->pp->hour, instance->pp->minute,
                     instance->pp->second,
 		    (long) tsp->tv_sec % 60,
@@ -2413,7 +2413,7 @@ oncore_msg_BaEaHa(
 	 */
 
 	instance->pp->year   = buf[6]*256+buf[7];
-	instance->pp->day    = ymd2yd(buf[6]*256+buf[7], buf[4], buf[5]);
+	instance->pp->yday   = ymd2yd(buf[6]*256+buf[7], buf[4], buf[5]);
 	instance->pp->hour   = buf[8];
 	instance->pp->minute = buf[9];
 	instance->pp->second = buf[10];


=====================================
ntpd/refclock_spectracom.c
=====================================
@@ -297,7 +297,7 @@ spectracom_receive(
 		 */
 		if (sscanf(pp->a_lastcode,
 		    "%c %3d %2d:%2d:%2d%c%cTZ=%2d",
-		    &syncchar, &pp->day, &pp->hour, &pp->minute,
+		    &syncchar, &pp->yday, &pp->hour, &pp->minute,
 		    &pp->second, &tmpchar, &dstchar, &tz) == 8) {
 			pp->nsec = 0;
 			break;
@@ -310,7 +310,7 @@ spectracom_receive(
 		 * Timecode format 2: "IQyy ddd hh:mm:ss.mmm LD" */
 		if (sscanf(pp->a_lastcode,
 		    "%c%c %2d %3d %2d:%2d:%2d.%3ld %c",
-		    &syncchar, &qualchar, &pp->year, &pp->day,
+		    &syncchar, &qualchar, &pp->year, &pp->yday,
 		    &pp->hour, &pp->minute, &pp->second, &pp->nsec,
 		    &leapchar) == 9) {
 			pp->nsec *= 1000000;
@@ -331,7 +331,7 @@ spectracom_receive(
 		    &syncchar, &pp->year, &month, &day, &pp->hour,
 		    &pp->minute, &pp->second, &dstchar, &leapchar) == 8)
 		    {
-			pp->day = ymd2yd(pp->year, month, day);
+			pp->yday = ymd2yd(pp->year, month, day);
 			pp->nsec = 0;
 			break;
 		}


=====================================
ntpd/refclock_trimble.c
=====================================
@@ -859,12 +859,12 @@ trimble_receive (
 	/* add sample to filter */
 	pp->lastref = pp->lastrec;
 	pp->year = up->date.year;
-	pp->day = up->date.yearday;
+	pp->yday = up->date.yearday;
 	pp->hour = up->date.hour;
 	pp->minute = up->date.minute;
 	pp->second = up->date.second;
 	DPRINT(2, ("trimble_receive: unit %d: %4d %03d %02d:%02d:%02d.%09ld\n",
-		   up->unit, pp->year, pp->day, pp->hour, pp->minute,
+		   up->unit, pp->year, pp->yday, pp->hour, pp->minute,
 		   pp->second, pp->nsec));
 	if (!refclock_process(pp)) {
 		refclock_report(peer, CEVNT_BADTIME);
@@ -930,7 +930,7 @@ trimble_poll (
 	/* record clockstats */
 	cl = snprintf(pp->a_lastcode, sizeof(pp->a_lastcode),
 		 "%4d %03d %02d:%02d:%02d.%09ld",
-		 pp->year, pp->day, pp->hour,pp->minute, pp->second, pp->nsec);
+		 pp->year, pp->yday, pp->hour,pp->minute, pp->second, pp->nsec);
 	pp->lencode = (cl < (int)sizeof(pp->a_lastcode)) ? cl : 0;
 	record_clock_stats(peer, pp->a_lastcode);
 


=====================================
ntpd/refclock_truetime.c
=====================================
@@ -376,7 +376,7 @@ true_receive(
 	    pp->a_lastcode[6] == ':' &&
 	    pp->a_lastcode[9] == ':' &&
 	    sscanf(pp->a_lastcode, "%3d:%2d:%2d:%2d%c",
-		   &pp->day, &pp->hour, &pp->minute,
+		   &pp->yday, &pp->hour, &pp->minute,
 		   &pp->second, &synced) == 5) {
 
 		/*
@@ -402,7 +402,7 @@ true_receive(
 			 * find out what time it really is. Include
 			 * the count from the PCL720
 			 */
-			if (!clocktime(pp->year, pp->day, pp->hour, pp->minute,
+			if (!clocktime(pp->year, pp->yday, pp->hour, pp->minute,
 				       pp->second, lfpuint(pp->lastrec),
 				       &pp->yearstart, &sec)) {
 				refclock_report(peer, CEVNT_BADTIME);


=====================================
ntpd/refclock_zyfer.c
=====================================
@@ -235,7 +235,7 @@ zyfer_receive(
 	 * Timecode sample: "!TIME,2002,017,07,59,32,2,4,1"
 	 */
 	if (sscanf(pp->a_lastcode, "!TIME,%4d,%3d,%2d,%2d,%2d,%d,%d,%d",
-		   &pp->year, &pp->day, &pp->hour, &pp->minute, &pp->second,
+		   &pp->year, &pp->yday, &pp->hour, &pp->minute, &pp->second,
 		   &tmode, &tfom, &omode) != 8) {
 		refclock_report(peer, CEVNT_BADREPLY);
 		return;


=====================================
pylib/ntpc.py
=====================================
@@ -147,11 +147,6 @@ _statustoa = _ntpc.statustoa
 _statustoa.restype = ctypes.c_char_p
 _statustoa.argtypes = [ctypes.c_int, ctypes.c_int]
 
-# Set time to nanosecond precision.
-set_tod = _ntpc.ntpc_set_tod
-set_tod.restype = ctypes.c_int
-set_tod.argtypes = [ctypes.c_int, ctypes.c_int]
-
 # Adjust system time by slewing.
 adj_systime = _ntpc.ntpc_adj_systime
 adj_systime.restype = ctypes.c_bool


=====================================
tests/libntp/prettydate.c
=====================================
@@ -8,15 +8,11 @@
 
 TEST_GROUP(prettydate);
 
-TEST_SETUP(prettydate) {
-    set_prettydate_pivot(settime(2000, 1, 1, 0, 0, 0));
-}
+TEST_SETUP(prettydate) {}
 
 TEST_TEAR_DOWN(prettydate) {}
 
 
-#include "ntp_fp.h"
-
 static const uint32_t HALF = 2147483648UL;
 
 TEST(prettydate, Rfc3339Date1) {
@@ -24,7 +20,7 @@ TEST(prettydate, Rfc3339Date1) {
 }
 
 TEST(prettydate, Rfc3339Time1) {
-	TEST_ASSERT_EQUAL_STRING("2036-02-07T06:28:16.000Z", rfc3339date(0));
+	TEST_ASSERT_EQUAL_STRING("1970-01-01T00:00Z", rfc3339time(0));
 }
 
 TEST(prettydate, ConstantDate) {


=====================================
tests/pylib/test_util.py
=====================================
@@ -738,54 +738,34 @@ class TestPylibUtilMethods(unittest.TestCase):
                        ("xmt",
                         ("0x40000000.00000000", "0x40000000.00000000"))))
             self.assertEqual(f(data),
-                             "reftime=00000000.00000000 "
-                             "2036-02-07T06:28:16.000Z,\n"
-                             "clock=10000000.00000000 "
-                             "1908-07-04T21:24:16.000Z,\n"
-                             "org=20000000.00000000 "
-                             "1917-01-05T18:48:32.000Z,\n"
-                             "rec=30000000.00000000 "
-                             "1925-07-09T16:12:48.000Z,\n"
-                             "xmt=40000000.00000000 "
-                             "1934-01-10T13:37:04.000Z\n")
+                   "reftime=00000000.00000000 2036-02-07T06:28:16.000Z,\n"
+                   "clock=10000000.00000000 2044-08-10T03:52:32.000Z,\n"
+                   "org=20000000.00000000 2053-02-11T01:16:48.000Z,\n"
+                   "rec=30000000.00000000 2061-08-14T22:41:04.000Z,\n"
+                   "xmt=40000000.00000000 2070-02-15T20:05:20.000Z\n")
             # Test prettydates, with units
             self.assertEqual(f(data, showunits=True),
-                             "reftime=00000000.00000000 "
-                             "2036-02-07T06:28:16.000Z,\n"
-                             "clock=10000000.00000000 "
-                             "1908-07-04T21:24:16.000Z,\n"
-                             "org=20000000.00000000 "
-                             "1917-01-05T18:48:32.000Z,\n"
-                             "rec=30000000.00000000 "
-                             "1925-07-09T16:12:48.000Z,\n"
-                             "xmt=40000000.00000000 "
-                             "1934-01-10T13:37:04.000Z\n")
+                   "reftime=00000000.00000000 2036-02-07T06:28:16.000Z,\n"
+                   "clock=10000000.00000000 2044-08-10T03:52:32.000Z,\n"
+                   "org=20000000.00000000 2053-02-11T01:16:48.000Z,\n"
+                   "rec=30000000.00000000 2061-08-14T22:41:04.000Z,\n"
+                   "xmt=40000000.00000000 2070-02-15T20:05:20.000Z\n")
             # Test wide terminal
             termsize = (160, 24)
             self.assertEqual(f(data),
-                             "reftime=00000000.00000000 "
-                             "2036-02-07T06:28:16.000Z, "
-                             "clock=10000000.00000000 "
-                             "1908-07-04T21:24:16.000Z, "
-                             "org=20000000.00000000 "
-                             "1917-01-05T18:48:32.000Z,\n"
-                             "rec=30000000.00000000 "
-                             "1925-07-09T16:12:48.000Z, "
-                             "xmt=40000000.00000000 "
-                             "1934-01-10T13:37:04.000Z\n")
+                   "reftime=00000000.00000000 2036-02-07T06:28:16.000Z, "
+                   "clock=10000000.00000000 2044-08-10T03:52:32.000Z, "
+                   "org=20000000.00000000 2053-02-11T01:16:48.000Z,\n"
+                   "rec=30000000.00000000 2061-08-14T22:41:04.000Z, "
+                   "xmt=40000000.00000000 2070-02-15T20:05:20.000Z\n")
             # Test narrow terminal
             termsize = (40, 24)
             self.assertEqual(f(data),
-                             "\nreftime=00000000.00000000 "
-                             "2036-02-07T06:28:16.000Z,\n"
-                             "clock=10000000.00000000 "
-                             "1908-07-04T21:24:16.000Z,\n"
-                             "org=20000000.00000000 "
-                             "1917-01-05T18:48:32.000Z,\n"
-                             "rec=30000000.00000000 "
-                             "1925-07-09T16:12:48.000Z,\n"
-                             "xmt=40000000.00000000 "
-                             "1934-01-10T13:37:04.000Z\n")
+                   "\nreftime=00000000.00000000 2036-02-07T06:28:16.000Z,\n"
+                   "clock=10000000.00000000 2044-08-10T03:52:32.000Z,\n"
+                   "org=20000000.00000000 2053-02-11T01:16:48.000Z,\n"
+                   "rec=30000000.00000000 2061-08-14T22:41:04.000Z,\n"
+                   "xmt=40000000.00000000 2070-02-15T20:05:20.000Z\n")
             termsize = (80, 24)
             # Test ex-obscure cooking
             data = od((("srcadr", ("1.1.1.1", "1.1.1.1")),



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/003a1148ede6a4ac5deaf2507ecfd3b40b07731a...bad4145cd3b024b81388e271f1b39368e00d53bc

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/003a1148ede6a4ac5deaf2507ecfd3b40b07731a...bad4145cd3b024b81388e271f1b39368e00d53bc
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20220204/f217b640/attachment-0001.htm>


More information about the vc mailing list