[Git][NTPsec/ntpsec][master] Invertible time scaling in the Python code.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 6 04:24:49 UTC 2016


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


Commits:
dee65278 by Eric S. Raymond at 2016-12-05T23:24:32-05:00
Invertible time scaling  in the Python code.

- - - - -


1 changed file:

- pylib/packet.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -431,7 +431,7 @@ class SyncPacket(Packet):
     def posix_to_ntp(t):
         "Scale from POSIX time to NTP time"
         # Note: assumes we're in the same NTP era as the transmitter...
-        return (t + SyncPacket.UNIX_EPOCH) * 2**32
+        return int((t + SyncPacket.UNIX_EPOCH) * 2**32)
 
     def posixize(self):
         self.root_delay *= 2**-16
@@ -440,7 +440,7 @@ class SyncPacket(Packet):
         self.origin_timestamp = SyncPacket.ntp_to_posix(self.origin_timestamp)
         self.receive_timestamp = SyncPacket.ntp_to_posix(self.receive_timestamp)
         self.transmit_timestamp = SyncPacket.ntp_to_posix(self.transmit_timestamp)
-        self.transmit_timestamp = SyncPacket.ntp_to_posix(self.received)
+        self.received = SyncPacket.ntp_to_posix(self.received)
 
     def t1(self):
         return self.origin_timestamp



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/dee65278ae23e4815d450c6807a403eb6fbcf718
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161206/f92b5c98/attachment.html>


More information about the vc mailing list