[Git][NTPsec/ntpsec][master] 3 commits: ntp_calendar: add missing return.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Apr 20 20:49:11 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
5ac4d688 by Gary E. Miller at 2017-04-20T13:40:25-07:00
ntp_calendar: add missing return.
- - - - -
07ddb94d by Gary E. Miller at 2017-04-20T13:40:40-07:00
magnavox: remove last __DATE__.
--epoch now seems fully implemented.
- - - - -
8cf918e3 by Gary E. Miller at 2017-04-20T13:48:11-07:00
EPOCH: remove all mention of __DATE__ and __TIME__
Use EPOCH instead.
- - - - -
4 changed files:
- devel/packaging.txt
- include/ntp_calendar.h
- libntp/ntp_calendar.c
- ntpd/refclock_magnavox.c
Changes:
=====================================
devel/packaging.txt
=====================================
--- a/devel/packaging.txt
+++ b/devel/packaging.txt
@@ -71,22 +71,20 @@ has a pivot date and resolves incoming timestamps to the era that
minimizes distance between now and the timestamp. This procedure
is part of the core protocol specification.
-An instance's pivot time is constructed from __TIME__/__DATE__ and
-thus binaries are intrinsically non-reproducible. Any
-alternative to this most recent possible pivot would decrease
-the span of time in the future over which it can achieve timebase
-synchronization with instances from later eras, degrading function.
+An instance's pivot time is constructed from EPOCH defined at configure
+time in config.h. If EPOCH is set to a known time then the binaries
+are reproducible. By default the EPOCH is the current configure
+time. You can override the EPOCH with '-waf --epoch' or using the
+SOURCE_DATE_EPOCH environment variable.
== Disambiguation of NMEA dates ==
-Due to bad design of NMEA0183, the reporting protocol used by many
-GPS sensors, the NMEA driver in NTPsec sometimes has to make an
-assumption about what century it is. Choice of a base-century
-hits the saame issues; using anything other than __TIME__/__DATE__
-would decrease the future span over which the driver's assumption
-is correct. The alternative - trusting the system clock to report
-the right century - could produce very bad behavior near century
-boundaries.
+Due to bad design of NMEA0183, the reporting protocol used by many GPS
+sensors, the NMEA driver in NTPsec sometimes has to make an assumption
+about what century it is. Choice of a base-century hits the same
+issues; so here the year derived from the EPOCH is also used. The
+alternative - trusting the system clock to report the right century -
+could produce very bad behavior near century boundaries.
== Unpredictable leap seconds ==
=====================================
include/ntp_calendar.h
=====================================
--- a/include/ntp_calendar.h
+++ b/include/ntp_calendar.h
@@ -55,10 +55,8 @@ extern systime_func_ptr ntpcal_set_timefunc(systime_func_ptr);
#define SECSPERAVGYEAR 31556952 /* mean year length over 400yrs */
/*
- * Get the build date & time. ATTENTION: The time zone is not specified!
- * This depends entirely on the C compilers' capabilities to properly
- * expand the '__TIME__' and '__DATE__' macros, as required by the C
- * standard.
+ * Get the build date & time in UTC. This depends on the EPOCH
+ * which is fixed at configure time.
*/
extern int
ntpcal_get_build_date(struct calendar * /* jd */);
=====================================
libntp/ntp_calendar.c
=====================================
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -86,7 +86,7 @@ ntpcal_get_build_date(
(int)jd->year, (int)jd->yearday, (int)jd->month, (int)jd->monthday,
(int)jd->hour, (int)jd->minute, (int)jd->second, (int)jd->weekday);
#endif
-
+ return true;
}
=====================================
ntpd/refclock_magnavox.c
=====================================
--- a/ntpd/refclock_magnavox.c
+++ b/ntpd/refclock_magnavox.c
@@ -176,6 +176,7 @@ mx4200_start(
struct refclockproc *pp;
int fd;
char gpsdev[20];
+ struct calendar date;
/*
* Open serial port
@@ -212,14 +213,10 @@ mx4200_start(
pp->clockdesc = DESCRIPTION;
memcpy((char *)&pp->refid, REFID, REFIDLEN);
peer->sstclktype = CTL_SST_TS_LF;
- /*
- * __DATE__ is in a format like "Jan 2 2017" or possibly "???
- * ?? ????". Thus it is guaranteed that there will be a
- * rightmost space just before the date. It's OK if atoi()
- * barfs on ???? because this is only used in a sanity check
- * where that will fail positive.
- */
- year_last_modified = atoi(strrchr(__DATE__, ' ') + 1);
+ /* find the base year for time, can't be before build date,
+ * unless we actually get some tests... */
+ ntpcal_get_build_date(&date);
+ year_last_modified = date.year;
/* Ensure the receiver is properly configured */
return mx4200_config(peer);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ff5c0d787a20952cdf3139e86b559eaf2e551b43...8cf918e318049767f452b4693de1cb45d7c6543a
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ff5c0d787a20952cdf3139e86b559eaf2e551b43...8cf918e318049767f452b4693de1cb45d7c6543a
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/20170420/14135c26/attachment.html>
More information about the vc
mailing list