[Git][NTPsec/ntpsec][master] 2 commits: ntpdig now properly accepts -g/--gap option

Ian Bruene gitlab at mg.gitlab.com
Sun Jul 16 17:22:03 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
2cff6779 by Ian Bruene at 2017-07-16T12:08:41-05:00
ntpdig now properly accepts -g/--gap option

- - - - -
d42e218a by Ian Bruene at 2017-07-16T12:12:12-05:00
Changed ntpdig -g to accept milliseconds, matching docs.

- - - - -


1 changed file:

- ntpclients/ntpdig


Changes:

=====================================
ntpclients/ntpdig
=====================================
--- a/ntpclients/ntpdig
+++ b/ntpclients/ntpdig
@@ -239,7 +239,7 @@ USAGE:  ntpdig [-<flag> [<val>] | --<name>[{=| }<val>]]...
    -c yes concurrent      Hosts to be queried concurrently
    -d no  debug           Increase debug verbosity
    -D yes set-debug-level Set debug verbosity
-   -g yes gap             Set gap between requests
+   -g yes gap             Set gap between requests in miliseconds
    -j no  json            Use JSON output format
    -l Str logfile         Log to specified logfile
                                  - prohibits the option 'syslog'
@@ -284,7 +284,7 @@ if __name__ == '__main__':
         authkey = None
         concurrent_hosts = []
         debug = 0
-        gap = 50
+        gap = .05
         json = False
         keyfile = None
         steplimit = 0       # Default is intentionally zero
@@ -309,6 +309,9 @@ if __name__ == '__main__':
                 elif switch in ("-D", "--set-debug-level"):
                     errmsg = "Error: -D parameter '%s' not a number\n"
                     debug = ntp.util.safeargcast(val, int, errmsg, usage)
+                elif switch in ("-g", "--gap"):
+                    errmsg = "Error: -g parameter '%s' not a number\n"
+                    gap = ntp.util.safeargcast(val, int, errmsg, usage)
                 elif switch in ("-j", "--json"):
                     json = True
                 elif switch in ("-k", "--keyfile"):
@@ -352,6 +355,8 @@ if __name__ == '__main__':
             sys.stderr.write(usage)
             raise SystemExit(1)
 
+        gap /= 1000  # convert to milliseconds
+
         credentials = keyid = keytype = passwd = None
         try:
             credentials = ntp.packet.Authenticator(keyfile)
@@ -369,8 +374,6 @@ if __name__ == '__main__':
             sys.stderr.write("-a option requires -k.\n")
             raise SystemExit(1)
 
-        gap /= 1000     # Scale gap to milliseconds
-
         if not arguments:
             arguments = ["localhost"]
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f5df6d7e84ba3aa9b3ecb9d9254eb239d685bf7d...d42e218ad0b585aa49faa56033ad3a1d565452dc

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/f5df6d7e84ba3aa9b3ecb9d9254eb239d685bf7d...d42e218ad0b585aa49faa56033ad3a1d565452dc
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/20170716/ef916d1b/attachment.html>


More information about the vc mailing list