[Git][NTPsec/ntpsec][master] 2 commits: Prevent ntp.util.rfc3339() from truncating fractional parts.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Dec 18 21:42:50 UTC 2016


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


Commits:
333b74ed by Eric S. Raymond at 2016-12-18T16:41:39-05:00
Prevent ntp.util.rfc3339() from truncating fractional parts.

- - - - -
4ad2e9c8 by Eric S. Raymond at 2016-12-18T16:41:45-05:00
In ntpmon, make 'd' go direct to detail mode.

- - - - -


3 changed files:

- docs/includes/ntpmon-body.txt
- ntpclients/ntpmon
- pylib/util.py


Changes:

=====================================
docs/includes/ntpmon-body.txt
=====================================
--- a/docs/includes/ntpmon-body.txt
+++ b/docs/includes/ntpmon-body.txt
@@ -39,7 +39,7 @@ If no hostname is specified on the command line, localhost is monitored.
 
 a:: Change peer display to apeers mode, showing association IDs.
 
-d:: Toggle select mode (some peer will be reverse-video highlighted when on).
+d:: Toggle detail mode (some peer will be reverse-video highlighted when on).
 
 j:: Select next peer (in select mode); arrow down also works.
 
@@ -59,14 +59,10 @@ w:: Toggle wide mode.
 
 x:: Cleanly terminate the program.
 
-<space>:: Rotate through display modes.
+<space>:: Rotate through a/n/o/p display modes.
 
 ?:: List these commands.
 
-When no peer is selected, <space> rotates through a/n/o/p display modes
-for the whole peers list. When a peer is selected, <space> toggles
-detail-display mode.
-
 == Options ==
 
 -V:: Display version and exit.


=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -4,7 +4,7 @@
 Any keystroke causes a poll and update. Keystroke commands:
 
 'a': Change peer display to apeers mode, showing association IDs.
-'d': Toggle select mode (some peer will be reverse-video highlighted when on).
+'d': Toggle detail mode (some peer will be reverse-video highlighted when on).
 'j': Select next peer (in select mode); arrow down also works.
 'k': Select previous peer (in select mode); arrow up also works.
 'n': Toggle display of hostnames (vs. IP addresses).
@@ -14,12 +14,8 @@ Any keystroke causes a poll and update. Keystroke commands:
 's': Show all hosts, not just reachable ones.
 'w': Toggle wide mode.
 'x': Cleanly terminate the program.
-' ': Rotate through display modes. 
+' ': Rotate through a/n/o/p display modes. 
 '?': Display helpscreen.
-
-When no peer is selected, <space> rotates through a/n/o/p display modes
-for the whole peers list. When a peer is selected, <space> toggles
-detail-display mode.
 '''
 
 from __future__ import print_function, division
@@ -250,6 +246,7 @@ if __name__ == '__main__':
                         if not selectmode:
                             selected = 0
                         selectmode = not selectmode
+                        detailmode = not detailmode
                     elif key == '?':
                         helpmode = True
                     elif key == 'n':
@@ -264,15 +261,12 @@ if __name__ == '__main__':
                     elif key == 'w':
                         peer_report.wideremote = not peer_report.wideremote
                     elif key == " ":
-                        if selectmode:
-                            detailmode = not detailmode
+                        if peer_report.displaymode == 'peers':
+                            peer_report.displaymode = 'apeers'
+                        elif peer_report.displaymode == 'apeers':
+                            peer_report.displaymode = 'opeers'
                         else:
-                            if peer_report.displaymode == 'peers':
-                                peer_report.displaymode = 'apeers'
-                            elif peer_report.displaymode == 'apeers':
-                                peer_report.displaymode = 'opeers'
-                            else:
-                                peer_report.displaymode = 'peers'
+                            peer_report.displaymode = 'peers'
                     elif key == 'j' or key == "KEY_DOWN":
                         selected += 1
                         selected %= len(peers)


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -36,7 +36,7 @@ def stdversion():
 def rfc3339(t):
     "RFC 3339 string from Unix time, including fractional second."
     rep = time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(t))
-    t = str(t)
+    t = "%f" % t
     if "." in t:
         subsec = t.split(".", 1)[1]
         if int(subsec) > 0:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/5ffaa3d1f54d831e905113dfda7ba141ece17bb3...4ad2e9c83baa966a397d54845ed0cacb7e80dada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161218/19835a63/attachment.html>


More information about the vc mailing list