Good day.

I understand that the authenticated TLS constraints are not for percision.
Nonetheless, I thought it might make sense to consider displaying the ntpctl
contraint offset output with greater percision to avoid it being misleading.

The text output below shows three values for the constraint offset:
 - current code, which only displays seconds (with no fractional value)
 - proposed change, which displays 3 decimal places (such as the ms values)
 - the original output (from pre r1.90)

I know the other "second" values do not display decimals, but they are for
"next" and "poll" which are inherently in second increments, while this is not
the case for the constraint offset value. The original NTP offset, delay and
jitter values are in ms to three decimail places.

Examples of extreme rounding:

1. When the constraint offset is positive, the fractional value is always
rounded down.

# ntpctl -s all
3/4 peers valid, constraint offset 0s, clock synced, stratum 3
3/4 peers valid, constraint offset 0.705s, clock synced, stratum 3
3/4 peers valid, constraint offset 0.704480, clock synced, stratum 3

peer
   wt tl st  next  poll          offset       delay      jitter
207.210.46.249 from pool pool.ntp.org 
 *  1 10  2   11s   34s        -1.188ms    13.879ms     2.142ms
104.167.113.112 from pool pool.ntp.org 
    1 10  2    7s   32s         0.311ms    16.699ms     2.482ms
206.108.0.133 from pool pool.ntp.org 
    1 10  1    9s   34s        -0.191ms    12.173ms     2.418ms
198.245.49.187 from pool pool.ntp.org 
    1  2  -   36s  300s             ---- peer not valid ----

2. When negative, the fractional value is always rounded up.

# ntpctl -s all
3/4 peers valid, constraint offset -1s, clock synced, stratum 3
3/4 peers valid, constraint offset -0.010s, clock synced, stratum 3
3/4 peers valid, constraint offset -0.009950, clock synced, stratum 3

peer
   wt tl st  next  poll          offset       delay      jitter
207.210.46.249 from pool pool.ntp.org 
 *  1 10  2   20s   33s        -3.105ms    17.920ms     6.845ms
104.167.113.112 from pool pool.ntp.org 
    1 10  2   14s   33s        -3.737ms    25.552ms    12.600ms
206.108.0.133 from pool pool.ntp.org 
    1 10  1   19s   32s        -2.649ms    17.749ms     8.458ms
198.245.49.187 from pool pool.ntp.org 
    1  2  -  230s  300s             ---- peer not valid ----

I was worried about such output until I read the code and understood what was
being done.

Is there any interest in changing this behaviour to display subseconds to
three decimal places? I think the output below is both consistent and
provides greater accuracy.

# ntpctl -s all

4/4 peers valid, constraint offset -0.116s, clock synced, stratum 2

peer
   wt tl st  next  poll          offset       delay      jitter
207.210.46.249 from pool pool.ntp.org 
    1 10  2   11s   31s       -14.134ms    45.379ms    38.187ms
104.167.113.112 from pool pool.ntp.org 
    1 10  2   20s   32s        -1.028ms    18.559ms     4.615ms
206.108.0.133 from pool pool.ntp.org 
 *  1 10  1   16s   30s        -1.240ms    14.337ms     4.410ms
198.245.49.187 from pool pool.ntp.org 
    1 10  2   22s   31s         0.657ms    32.628ms     5.008ms

Diff below for your consideration.

Regards,



Index: ntpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.94
diff -u -p -r1.94 ntpd.c
--- ntpd.c      18 Jul 2015 00:53:44 -0000      1.94
+++ ntpd.c      17 Sep 2015 14:29:51 -0000
@@ -698,8 +698,8 @@ show_status_msg(struct imsg *imsg)
                tv.tv_sec = cstatus->constraint_median +
                    (getmonotime() - cstatus->constraint_last);
                tv.tv_usec = 0;
-               d_to_tv(gettime_from_timeval(&tv) - gettime(), &tv);
-               printf("constraint offset %llds", (long long)tv.tv_sec);
+               printf("constraint offset %0.3fs",
+                   gettime_from_timeval(&tv) - gettime());
                if (cstatus->constraint_errors)
                        printf(" (%d errors)",
                            cstatus->constraint_errors);

Reply via email to