[Git][NTPsec/ntpsec][master] ntpwait: fix for Python3, %.1f time precision, pep8

Gary E. Miller gitlab at mg.gitlab.com
Tue Aug 15 23:23:03 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
224c2d1f by Gary E. Miller at 2017-08-15T16:21:55-07:00
ntpwait: fix for Python3, %.1f time precision, pep8

- - - - -


1 changed file:

- ntpclients/ntpwait


Changes:

=====================================
ntpclients/ntpwait
=====================================
--- a/ntpclients/ntpwait
+++ b/ntpclients/ntpwait
@@ -128,6 +128,7 @@ class Unbuffered(object):
     def __getattr__(self, attr):
         return getattr(self.stream, attr)
 
+
 def monoclock():
     "Try to get a monotonic clock value unaffected by NTP stepping."
     try:
@@ -195,7 +196,7 @@ if __name__ == "__main__":
                 sys.stdout.write("\b" + msg + "\n")
             sys.exit(1)
 
-        m = re.search(r"leap=([^,]*),", session.response)
+        m = re.search(r"leap=([^,]*),", repr(session.response))
         if m:
             leap = int(m.group(1))
         else:
@@ -213,7 +214,8 @@ if __name__ == "__main__":
                     ntp.magic.LEAP_DELSECOND):
             # We could check "sync" here to make sure we like the source...
             if verbose:
-                sys.stdout.write("\bOK! (%d seconds)\n" % (monoclock() - basetime))
+                sys.stdout.write("\bOK! (%.1f seconds)\n" %
+                                 (monoclock() - basetime))
             sys.exit(0)
 
         sys.stdout.write("\bUnexpected 'leap' status <%s>\n" % leap)



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/224c2d1ff0d970cacb00e862f8aa86432f1bf25a
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/20170815/0bbe120c/attachment.html>


More information about the vc mailing list