[Git][NTPsec/ntpsec][master] More ntpviz bugfixes.

Eric S. Raymond gitlab at mg.gitlab.com
Fri Aug 12 15:58:29 UTC 2016


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


Commits:
c36a4f3d by Eric S. Raymond at 2016-08-12T11:58:07-04:00
More ntpviz bugfixes.

- - - - -


1 changed file:

- ntpstats/ntpstats.py


Changes:

=====================================
ntpstats/ntpstats.py
=====================================
--- a/ntpstats/ntpstats.py
+++ b/ntpstats/ntpstats.py
@@ -113,26 +113,11 @@ class NTPStats:
         return key	# Someday, be smarter than this.
 
 def isotime(s):
-    "Convert timestamps in ISO8661 format to and from Unix time including optional fractional seconds."
-    if isinstance(s, int):
-        return time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(s))
-    elif isinstance(s, float):
-        date = int(s)
-        msec = s - date
-        date = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(s))
-        return date + "." + repr(msec)[3:]
-    elif isinstance(s, str) or isinstance(s, unicode):
-        if s[-1] == "Z":
-            s = s[:-1]
-        if "." in s:
-            (date, msec) = s.split(".")
-        else:
-            date = s
-            msec = "0"
-        # Note: no leap-second correction!
-        return time.mktime(time.strptime(date, "%Y-%m-%dT%H:%M:%S")) + float("0." + msec)
+    "Accept timestamps in ISO8661 format or numeric POSIX time."
+    if s.isdigit(s):
+        return int(s)
     else:
-        raise TypeError
+        return time.mktime(time.strptime(date, "%Y-%m-%dT%H:%M:%S"))
 
 def gnuplot(template):
     "Run a specified GNUPLOT program."



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


More information about the vc mailing list