From 3111be41c213a41d85542a08d11bc5b6c135269d Mon Sep 17 00:00:00 2001 From: Maxim Konovalov Date: Mon, 21 Jul 2003 11:06:47 +0000 Subject: [PATCH] Quote from a Problem Report: The output format specifier for the round-trip time in ping6 should be changed to %.3f instead of %g since %g doesn't accurately represent the precision of the number being output. In particular, %g truncates trailing zeroes. 0.01 ms does not mean the same thing as 0.010 ms. Although they are numerically identical, they do not have the same precision. PR: bin/52324, bin/52750 Submitted by: dg MFC after: 1 week --- sbin/ping6/ping6.c | 2 +- usr.sbin/traceroute6/traceroute6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 9f43a232d9f..c8f3ba83f2c 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1474,7 +1474,7 @@ pr_pack(buf, cc, mhdr) sizeof(dstsa))); } if (timing) - (void)printf(" time=%g ms", triptime); + (void)printf(" time=%.3f ms", triptime); if (dupflag) (void)printf("(DUP!)"); /* check the data */ diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index da3ff1cdf95..8b93a847740 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -867,7 +867,7 @@ main(argc, argv) print(&rcvmhdr, cc); lastaddr = Rcv.sin6_addr; } - Printf(" %g ms", deltaT(&t1, &t2)); + Printf(" %.3f ms", deltaT(&t1, &t2)); switch(i - 1) { case ICMP6_DST_UNREACH_NOROUTE: ++unreachable;