[Git][NTPsec/ntpsec][master] Allow the period argument with -p to be a float.

Gary E. Miller gitlab at mg.gitlab.com
Thu Sep 29 00:21:46 UTC 2016


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


Commits:
8484b9a2 by Gary E. Miller at 2016-09-28T17:21:07-07:00
Allow the period argument with -p to be a float.

Now you can plot the last 12 hours easily: ntpviz -p 0.5

- - - - -


2 changed files:

- docs/includes/ntpviz-body.txt
- ntpstats/ntpviz


Changes:

=====================================
docs/includes/ntpviz-body.txt
=====================================
--- a/docs/includes/ntpviz-body.txt
+++ b/docs/includes/ntpviz-body.txt
@@ -43,7 +43,8 @@ yyyy-mmm-ddThh:mm:ss. Alternatively you can specify either -s or -e
 (but not both) and use -p to set the default period in days.  The
 default is for the period to be 7 days, the end time to match the last
 logfile entry, and the start time to be set so that adding the period
-just reaches the last logfile entry.
+just reaches the last logfile entry.  The arugment with -p may be a
+floating point number.
 
 The -D N set the debug level to N and outputs with more verbosity.  0
 is the default, quiet except for all ERRORs and some WARNINGs.  9 is


=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -692,7 +692,7 @@ if __name__ == '__main__':
         elif switch == "-n":
             sitename = val
         elif switch == "-p":
-            period = int(val) * NTPStats.SecondsInWeek
+            period = int( float(val) * NTPStats.SecondsInWeek)
         elif switch == "-s":
             starttime = iso_to_posix(val)
         elif switch == "-o":
@@ -988,8 +988,8 @@ Report generated: %(start_time_str)s UTC <br>
 
     # Ugh.  Not clear what to do in the multiplot case
     if len(statlist) == 1:
-        index_header += 'Report Period: %s days <br></div> ' \
-                 % int(stats.period // NTPStats.SecondsInWeek)
+        index_header += 'Report Period: %1.1f days <br></div> ' \
+                 % (float(stats.period) / float(NTPStats.SecondsInWeek))
     index_header += '<div style="clear:both;"></div>'
 
     index_trailer = '''\



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


More information about the vc mailing list