[Git][NTPsec/ntpsec][master] Express a timestamp conversion more elegantly.

Eric S. Raymond gitlab at mg.gitlab.com
Fri Jan 6 03:28:48 UTC 2017


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


Commits:
7e183e1f by Eric S. Raymond at 2017-01-05T22:28:42-05:00
Express a timestamp conversion more elegantly.

- - - - -


1 changed file:

- ntptime/ntptime.c


Changes:

=====================================
ntptime/ntptime.c
=====================================
--- a/ntptime/ntptime.c
+++ b/ntptime/ntptime.c
@@ -329,9 +329,7 @@ main(
 #endif
 		tv.tv_sec = ntv.time.tv_sec;
 		tv.tv_usec = ntv.time.tv_frac_sec;
-		setlfpuint(ts, (u_long)tv.tv_sec);   \
-		setlfpfrac(ts, TVUTOTSF(tv.tv_usec)); \
-		setlfpuint(ts, lfpuint(ts) + JAN_1970);
+		ts = tspec_stamp_to_lfp(tval_to_tspec(tv));
 		setlfpfrac(ts, lfpfrac(ts) + ts_roundbit);
 		setlfpfrac(ts, lfpfrac(ts) & ts_mask);
 		printf(json ? jfmt2 : ofmt2,  json ? rfc3339date(ts) : prettydate(ts), fdigits, (int)time_frac);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/7e183e1f73212c44c07a47b5c1db064ba8af25fc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170106/cff7354f/attachment.html>


More information about the vc mailing list