[Git][NTPsec/ntpsec][master] Address GitLab issue #402: ntpdig: no fraction of seconds

Eric S. Raymond gitlab at mg.gitlab.com
Mon Oct 2 12:16:31 UTC 2017


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


Commits:
c79bc627 by Eric S. Raymond at 2017-10-02T08:15:42-04:00
Address GitLab issue #402: ntpdig: no fraction of seconds

- - - - -


2 changed files:

- ntpclients/ntpdig
- pylib/packet.py


Changes:

=====================================
ntpclients/ntpdig
=====================================
--- a/ntpclients/ntpdig
+++ b/ntpclients/ntpdig
@@ -212,7 +212,7 @@ def report(packet, json):
     digits = min(6, -int(math.log10(2**packet.precision)))
 
     date = time.strftime("%Y-%m-%d", t)
-    tod = time.strftime("%T", t) + (".%*d" % (digits, ms))
+    tod = time.strftime("%T", t) + (".%-*d" % (digits, ms)).rstrip()
     sgn = ("%+d" % tmoffset)[0]
     tz = "%s%02d%02d" % (sgn, abs(tmoffset) // 60, tmoffset % 60)
 


=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -445,7 +445,7 @@ class SyncPacket(Packet):
     def ntp_to_posix(t):
         "Scale from NTP time to POSIX time"
         # Note: assumes we're in the same NTP era as the transmitter...
-        return (t >> 32) - SyncPacket.UNIX_EPOCH
+        return (t / (2**32)) - SyncPacket.UNIX_EPOCH
 
     @staticmethod
     def posix_to_ntp(t):



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c79bc62711675cd73aeac6d8c940b9bbe8ce40e7
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/20171002/8b0f58bc/attachment.html>


More information about the vc mailing list