Browse Source

Tweak previous:

* For time_t values, use the printf("%lld", (long long)t) idiom.
* Don't print "Invalid program name" in usage() when main() just runs ntpd.
* Make "Show/Shows" consistent in the manual, sort .Xr and correct .Ox.
OK phessler@
OPENBSD_5_5
schwarze 10 years ago
parent
commit
c595a4fa35
2 changed files with 18 additions and 19 deletions
  1. +7
    -7
      src/usr.sbin/ntpd/ntpctl.8
  2. +11
    -12
      src/usr.sbin/ntpd/ntpd.c

+ 7
- 7
src/usr.sbin/ntpd/ntpctl.8 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ntpctl.8,v 1.1 2013/10/04 14:28:16 phessler Exp $
.\" $OpenBSD: ntpctl.8,v 1.2 2013/10/04 20:30:38 schwarze Exp $
.\" .\"
.\" Copyright (c) 2012 Mike Miller <mmiller@mgm51.com> .\" Copyright (c) 2012 Mike Miller <mmiller@mgm51.com>
.\" .\"
@ -48,21 +48,21 @@ as reported by the
system call, is displayed. system call, is displayed.
.Pp .Pp
.It Fl s Cm peers .It Fl s Cm peers
Shows the following information about each peer: weight, trustlevel,
Show the following information about each peer: weight, trustlevel,
stratum, number of seconds until the next poll, polling interval stratum, number of seconds until the next poll, polling interval
in seconds, and offset, network delay and network jitter in in seconds, and offset, network delay and network jitter in
milliseconds. When the system clock is synced to a peer, an asterisk milliseconds. When the system clock is synced to a peer, an asterisk
is displayed to the left of the weight column for that peer. is displayed to the left of the weight column for that peer.
.Pp .Pp
.It Fl s Cm sensors .It Fl s Cm sensors
Shows the following information about each sensor: weight, sensor "good"
Show the following information about each sensor: weight, sensor "good"
status, stratum, and offset and the configured correction in status, stratum, and offset and the configured correction in
milliseconds. milliseconds.
When the system clock is synced to a sensor, an asterisk When the system clock is synced to a sensor, an asterisk
is displayed to the left of the weight column for that sensor. is displayed to the left of the weight column for that sensor.
.Pp .Pp
.It Fl s Cm all .It Fl s Cm all
Shows all of the above.
Show all of the above.
.El .El
.Sh FILES .Sh FILES
.Bl -tag -width "/var/db/ntpd.driftXXX" -compact .Bl -tag -width "/var/db/ntpd.driftXXX" -compact
@ -72,10 +72,10 @@ Socket file for communication with
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr adjtime 2 , .Xr adjtime 2 ,
.Xr ntpd 8 ,
.Xr ntpd.conf 5
.Xr ntpd.conf 5 ,
.Xr ntpd 8
.Sh HISTORY .Sh HISTORY
The The
.Nm .Nm
program first appeared in program first appeared in
.Ox 5.3 .
.Ox 5.5 .

+ 11
- 12
src/usr.sbin/ntpd/ntpd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.70 2013/10/04 14:28:16 phessler Exp $ */
/* $OpenBSD: ntpd.c,v 1.71 2013/10/04 20:30:38 schwarze Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -80,13 +80,11 @@ usage(void)
{ {
extern char *__progname; extern char *__progname;
if (strcmp(__progname, "ntpd") == 0)
if (strcmp(__progname, "ntpctl") == 0)
fprintf(stderr, "usage: ntpctl [-s modifier]\n");
else
fprintf(stderr, "usage: %s [-dnSsv] [-f file]\n", fprintf(stderr, "usage: %s [-dnSsv] [-f file]\n",
__progname); __progname);
else if (strcmp(__progname, "ntpctl") == 0)
fprintf(stderr, "usage: %s [-s modifier]\n", __progname);
else
fprintf(stderr, "Invalid program name: %s\n", __progname);
exit(1); exit(1);
} }
@ -741,10 +739,10 @@ show_peer_msg(struct imsg *imsg, int calledfromshowall)
else else
strlcpy (stratum, " -", sizeof (stratum)); strlcpy (stratum, " -", sizeof (stratum));
printf("%s\n %1s %2u %2u %2s %4ds %4ds",
printf("%s\n %1s %2u %2u %2s %4llds %4llds",
cpeer->peer_desc, cpeer->syncedto == 1 ? "*" : " ", cpeer->peer_desc, cpeer->syncedto == 1 ? "*" : " ",
cpeer->weight, cpeer->trustlevel, stratum, cpeer->next,
cpeer->poll);
cpeer->weight, cpeer->trustlevel, stratum,
(long long)cpeer->next, (long long)cpeer->poll);
if (cpeer->trustlevel >= TRUSTLEVEL_BADPEER) if (cpeer->trustlevel >= TRUSTLEVEL_BADPEER)
printf(" %12.3fms %9.3fms %8.3fms\n", cpeer->offset, printf(" %12.3fms %9.3fms %8.3fms\n", cpeer->offset,
@ -786,9 +784,10 @@ show_sensor_msg(struct imsg *imsg, int calledfromshowall)
"offset correction\n"); "offset correction\n");
} }
printf("%s\n %1s %2u %2u %2u %4ds %4ds", csensor->sensor_desc,
csensor->syncedto == 1 ? "*" : " ", csensor->weight, csensor->good,
csensor->stratum, csensor->next, csensor->poll);
printf("%s\n %1s %2u %2u %2u %4llds %4llds",
csensor->sensor_desc, csensor->syncedto == 1 ? "*" : " ",
csensor->weight, csensor->good, csensor->stratum,
(long long)csensor->next, (long long)csensor->poll);
if (csensor->good == 1) if (csensor->good == 1)
printf(" %11.3fms %9.3fms\n", printf(" %11.3fms %9.3fms\n",


Loading…
Cancel
Save