[Git][NTPsec/ntpsec][master] ntpq: Make packet columns of collect_display2 be like collect_display.

Richard Laager (@rlaager) gitlab at mg.gitlab.com
Sun Apr 24 23:42:59 UTC 2022



Richard Laager pushed to branch master at NTPsec / ntpsec


Commits:
3a38dc89 by James Browning at 2022-04-24T23:34:09+00:00
ntpq: Make packet columns of collect_display2 be like collect_display.

- - - - -


1 changed file:

- ntpclients/ntpq.py


Changes:

=====================================
ntpclients/ntpq.py
=====================================
@@ -447,23 +447,24 @@ usage: timeout [ msec ]
                         display2 = ntp.util.unitifyvar(rawvalue2, name)
                     else:
                         display2 = value2
-                    self.say("%13s   %12s %12s\n" %
-                             (legend, display, display2))
+                        self.say(
+                            "{0:<13} {1:>13} {2:>13}\n".format(
+                                legend, display, display2)
+                        )
                 elif fmt == NTP_PACKETS:
                     self.say(
-                        "{0:<13} {1[0]:>15} {2[0]:>15} {1[1]:>12}{1[2]:<3} {2[1]:>12}{2[2]:<3}\n".format(
-                            legend,
-                            ntp.util.packetize(value, runs),
-                            ntp.util.packetize(
-                                value2, runl, periodized=True, clipdigits=3
-                            ),
+                        "{0:<13} {1[0]:>13} {2[0]:>13} {1[1]:>10}{1[2]:<3} {2[1]:>10}{2[2]:<3}\n".format(
+                                legend,
+                                ntp.util.packetize(value, runs),
+                                ntp.util.packetize(value2, runl),
                         )
                     )
                 elif fmt == NTP_UPTIME:
                     runs, display = ntp.util.periodize(value)
                     runl, display2 = ntp.util.periodize(value2)
                     self.say(
-                        "{0:<13} {1:>15} {2:>15}\n".format(legend, display, display2)
+                        "{0:<13} {1:>13} {2:>13}\n".format(
+                            legend, display, display2)
                     )
                 else:
                     self.warn("unexpected vc type %s for %s, value %s %s    "
@@ -526,20 +527,21 @@ usage: timeout [ msec ]
                             value, family=self.ai_family)
                         if self.debug:
                             self.say("DNS lookup complete.")
-                    self.say("%s  %s\n" % (legend, value))
+                    self.say("%13s %13s\n" % (legend, value))
                 elif fmt == NTP_STR:
                     if value:
-                        self.say("%s  %s\n" % (legend, value))
+                        self.say("%13s %13s\n" % (legend, value))
                 elif fmt in (NTP_UINT, NTP_INT, NTP_FLOAT):
                     if self.showunits:
                         displayvalue = ntp.util.unitifyvar(rawvalue, name)
                     else:
                         displayvalue = value
-                    self.say("%13s   %13s\n" % (legend, displayvalue))
+                    self.say("%13s %13s\n" % (legend, displayvalue))
                 elif fmt == NTP_LFP:
-                    self.say("%s  %s\n" % (legend, ntp.ntpc.prettydate(value)))
+                    self.say("%13s %13s\n" % (
+                        legend, ntp.ntpc.prettydate(value)))
                 elif fmt == NTP_2BIT:
-                    self.say("%s  %s\n"
+                    self.say("%13s %13s\n"
                              % (legend, ("00", "01", "10", "11")[value]))
                 elif fmt == NTP_MODE:
                     modes = (
@@ -553,13 +555,13 @@ usage: timeout [ msec ]
                         self.say("%s  %s%d\n" % (legend, "mode#", value))
                 elif fmt == NTP_PACKETS:
                     self.say(
-                        "{0:<13} {1[0]:>15} {1[1]:>8}{1[2]:<3}\n".format(
+                        "{0:<13} {1[0]:>13} {1[1]:>10}{1[2]:<3}\n".format(
                             legend, ntp.util.packetize(value, run)
                         )
                     )
                 elif fmt == NTP_UPTIME:
                     run, display = ntp.util.periodize(value)
-                    self.say("{0:<13} {1:>15}\n".format(legend, display))
+                    self.say("{0:<13} {1:>13}\n".format(legend, display))
                 else:
                     self.warn("unexpected vc type %s for %s, value %s"
                               % (fmt, name, value))



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/3a38dc89fcaaff6889a82f7f97c1e0bef16a468f

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/3a38dc89fcaaff6889a82f7f97c1e0bef16a468f
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/20220424/3a91d87d/attachment-0001.htm>


More information about the vc mailing list