[Git][NTPsec/ntpsec][master] Rename EPOCH to BUILD_EPOCH to reduce ambiguity

Matt Selsky gitlab at mg.gitlab.com
Sun Apr 23 15:25:53 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
356cfb16 by Matt Selsky at 2017-04-23T11:22:16-04:00
Rename EPOCH to BUILD_EPOCH to reduce ambiguity

- - - - -


5 changed files:

- devel/packaging.txt
- include/ntp_calendar.h
- libntp/ntp_calendar.c
- wafhelpers/configure.py
- wafhelpers/options.py


Changes:

=====================================
devel/packaging.txt
=====================================
--- a/devel/packaging.txt
+++ b/devel/packaging.txt
@@ -71,11 +71,11 @@ 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 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 time when the last './waf
-configure' was run.  You can override the EPOCH with '-waf --epoch' or
-using the SOURCE_DATE_EPOCH environment variable.
+An instance's pivot time is constructed from BUILD_EPOCH defined at configure
+time in config.h.  If BUILD_EPOCH is set to a known time then the binaries are
+reproducible.  By default the BUILD_EPOCH is the time when the last './waf
+configure' was run.  You can override the BUILD_EPOCH with '-waf --build-epoch'
+or using the SOURCE_DATE_EPOCH environment variable.
 
 More information on reproduceable builds is at:
 https://reproducible-builds.org/[https://reproducible-builds.org/]
@@ -85,7 +85,7 @@ https://reproducible-builds.org/[https://reproducible-builds.org/]
 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
+issues; so here the year derived from the BUILD_EPOCH is also used.  The
 alternative - trusting the system clock to report the right century -
 could produce very bad behavior near century boundaries.
 


=====================================
include/ntp_calendar.h
=====================================
--- a/include/ntp_calendar.h
+++ b/include/ntp_calendar.h
@@ -55,7 +55,7 @@ extern systime_func_ptr ntpcal_set_timefunc(systime_func_ptr);
 #define	SECSPERAVGYEAR	31556952	/* mean year length over 400yrs */
 
 /*
- * Get the build date & time in UTC.  This depends on the EPOCH
+ * Get the build date & time in UTC.  This depends on the BUILD_EPOCH
  * which is fixed at configure time.
  */
 extern int


=====================================
libntp/ntp_calendar.c
=====================================
--- a/libntp/ntp_calendar.c
+++ b/libntp/ntp_calendar.c
@@ -58,7 +58,7 @@ ntpcal_get_build_date(
 	struct calendar * jd
 	)
 {
-        time_t epoch = (time_t)EPOCH;
+        time_t epoch = (time_t)BUILD_EPOCH;
         struct tm *epoch_tm;
 
 	ZERO(*jd);


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -813,16 +813,18 @@ int main(int argc, char **argv) {
                 msg("WARNING: This system has a 32-bit time_t.")
                 msg("WARNING: Your ntpd will fail on 2038-01-19T03:14:07Z.")
 
-    epoch = os.getenv('SOURCE_DATE_EPOCH', None)
-    if ctx.options.epoch:
-        ctx.define("EPOCH", ctx.options.epoch, comment="Using --epoch")
-    elif epoch:
-        if not epoch.isdigit():
+    source_date_epoch = os.getenv('SOURCE_DATE_EPOCH', None)
+    if ctx.options.build_epoch:
+        ctx.define("BUILD_EPOCH", ctx.options.build_epoch,
+                   comment="Using --build-epoch")
+    elif source_date_epoch:
+        if not source_date_epoch.isdigit():
             msg("ERROR: malformed SOURCE_DATE_EPOCH")
             sys.exit(1)
-        ctx.define("EPOCH", int(epoch), comment="Using SOURCE_DATE_EPOCH")
+        ctx.define("BUILD_EPOCH", int(source_date_epoch),
+                   comment="Using SOURCE_DATE_EPOCH")
     else:
-        ctx.define("EPOCH", int(time.time()), comment="Using default EPOCH")
+        ctx.define("BUILD_EPOCH", int(time.time()), comment="Using default")
 
     ctx.start_msg("Writing configuration header:")
     ctx.write_config_header("config.h")


=====================================
wafhelpers/options.py
=====================================
--- a/wafhelpers/options.py
+++ b/wafhelpers/options.py
@@ -70,7 +70,7 @@ def options_cmd(ctx, config):
     grp.add_option('--cflags', type='string', action="callback",
                    callback=callback_flags,
                    help="Users should use CFLAGS in their environment.")
-    grp.add_option( '--epoch', type='int', default=None,
+    grp.add_option( '--build-epoch', type='int', default=None,
         help="Force epoch, or use SOURCE_DATE_EPOCH in environment")
     grp.add_option('--ldflags', type='string', action="callback",
                    callback=callback_flags,



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/356cfb167032627d01054e985f216988c7544f7f

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/356cfb167032627d01054e985f216988c7544f7f
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/20170423/106f7240/attachment.html>


More information about the vc mailing list