client: print invalid intervals as dash
Instead of printing some large arbitrary values use dash in the LastRx column of the sources output and the Last/Int columns in the clients output when no sample or hit is recorded.
This commit is contained in:
parent
f50b520557
commit
302abf8480
1 changed files with 26 additions and 7 deletions
33
client.c
33
client.c
|
@ -1544,7 +1544,10 @@ static void
|
||||||
print_seconds(unsigned long s)
|
print_seconds(unsigned long s)
|
||||||
{
|
{
|
||||||
unsigned long d;
|
unsigned long d;
|
||||||
if (s <= 1024) {
|
|
||||||
|
if (s == (uint32_t)-1) {
|
||||||
|
printf(" -");
|
||||||
|
} else if (s <= 1024) {
|
||||||
printf("%4ld", s);
|
printf("%4ld", s);
|
||||||
} else if (s < 36000) {
|
} else if (s < 36000) {
|
||||||
printf("%3ldm", s / 60);
|
printf("%3ldm", s / 60);
|
||||||
|
@ -1644,6 +1647,18 @@ print_signed_freq_ppm(double f)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_clientlog_interval(int rate)
|
||||||
|
{
|
||||||
|
if (rate >= 127) {
|
||||||
|
printf(" -");
|
||||||
|
} else {
|
||||||
|
printf("%2d", rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_for_verbose_flag(char *line)
|
check_for_verbose_flag(char *line)
|
||||||
{
|
{
|
||||||
|
@ -2084,13 +2099,17 @@ process_cmd_clients(char *line)
|
||||||
DNS_IPAddress2Name(&ip, hostname, sizeof (hostname));
|
DNS_IPAddress2Name(&ip, hostname, sizeof (hostname));
|
||||||
|
|
||||||
printf("%-25s", hostname);
|
printf("%-25s", hostname);
|
||||||
printf(" %6"PRIu32" %5"PRIu16" %2d %2d ",
|
printf(" %6"PRIu32" %5"PRIu16" ",
|
||||||
ntohl(client->ntp_hits), ntohs(client->ntp_drops),
|
ntohl(client->ntp_hits), ntohs(client->ntp_drops));
|
||||||
client->ntp_interval, client->ntp_timeout_interval);
|
print_clientlog_interval(client->ntp_interval);
|
||||||
|
printf(" ");
|
||||||
|
print_clientlog_interval(client->ntp_timeout_interval);
|
||||||
|
printf(" ");
|
||||||
print_seconds(ntohl(client->last_ntp_hit_ago));
|
print_seconds(ntohl(client->last_ntp_hit_ago));
|
||||||
printf(" %6"PRIu32" %5"PRIu16" %2d ",
|
printf(" %6"PRIu32" %5"PRIu16" ",
|
||||||
ntohl(client->cmd_hits), ntohs(client->cmd_drops),
|
ntohl(client->cmd_hits), ntohs(client->cmd_drops));
|
||||||
client->cmd_interval);
|
print_clientlog_interval(client->cmd_interval);
|
||||||
|
printf(" ");
|
||||||
print_seconds(ntohl(client->last_cmd_hit_ago));
|
print_seconds(ntohl(client->last_cmd_hit_ago));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue