From: Harlan Stenn Date: Sat, 20 Aug 2011 02:42:48 +0000 (+0000) Subject: Have sntp report synchronization distance instead of root dispersion X-Git-Tag: NTP_4_2_7P206~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c4a69476ae35038bbb27cffe9970361f5f57f53;p=thirdparty%2Fntp.git Have sntp report synchronization distance instead of root dispersion bk: 4e4f1f28Qwlp6_M3tF0nOksXmIezpQ --- diff --git a/ChangeLog b/ChangeLog index 086870ee0..f0e8dcf20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* Have sntp report synchronization distance instead of root dispersion. +* Clean up ntp-wait-opts.def . (4.2.7p205) 2011/08/19 Released by Harlan Stenn * [Bug 1992] util/tg2 doesn't compile, needs libntp. (4.2.7p204) 2011/08/16 Released by Harlan Stenn diff --git a/scripts/ntp-wait-opts.def b/scripts/ntp-wait-opts.def index d5b7be160..6e82d2198 100644 --- a/scripts/ntp-wait-opts.def +++ b/scripts/ntp-wait-opts.def @@ -15,35 +15,33 @@ test-main; // #include version.def flag = { - value = n; - arg-type = number; - arg-name = num-tries; - descrip = "Number of times to check ntpd"; - doc = <<- _EndOfDoc_ + value = n; + arg-type = number; + arg-name = "num-tries"; + arg-default = 100; + descrip = "Number of times to check ntpd"; + doc = <<- _EndOfDoc_ The maximum number of times we will check ntpd to see if it has been able to synchronize and stabilize the system clock. - - The default is 100 times. _EndOfDoc_; }; flag = { - value = s; - arg-type = number; - arg-name = secs-between-tries; - descrip = "How long to sleep between tries"; - doc = <<- _EndOfDoc_ - We will sleep for secs-between-tries after each query of ntpd + value = s; + arg-type = number; + arg-name = "secs-between-tries"; + arg-default = 6; + descrip = "How long to sleep between tries"; + doc = <<- _EndOfDoc_ + We will sleep for @file{secs-between-tries} after each query of ntpd that returns "the time is not yet stable". - - The default is 6 seconds. _EndOfDoc_; }; flag = { - value = v; - descrip = "Be verbose"; - doc = <<- _EndOfDoc_ + value = v; + descrip = "Be verbose"; + doc = <<- _EndOfDoc_ By default, ntp-wait is silent. With this option, ntp-wait will provide status information. _EndOfDoc_; diff --git a/sntp/main.c b/sntp/main.c index 98cda4aed..5b1e11bcd 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -1115,7 +1115,7 @@ handle_pkt( char * ts_str; double offset; double precision; - double root_dispersion; + double synch_distance; char * p_SNTP_PRETEND_TIME; time_t pretend_time; #if SIZEOF_TIME_T == 8 @@ -1184,7 +1184,7 @@ handle_pkt( } offset_calculation(rpkt, rpktl, &tv_dst, &offset, - &precision, &root_dispersion); + &precision, &synch_distance); time_derived = TRUE; for (digits = 0; (precision *= 10.) < 1.; ++digits) @@ -1197,9 +1197,9 @@ handle_pkt( if (0 == stratum) stratum = 16; - if (root_dispersion > 0) { + if (synch_distance > 0) { cnt = snprintf(disptxt, sizeof(disptxt), - " +/- %f", root_dispersion); + " +/- %f", synch_distance); if (cnt >= sizeof(disptxt)) snprintf(disptxt, sizeof(disptxt), "ERROR %d >= %d", cnt, @@ -1237,7 +1237,7 @@ offset_calculation( struct timeval *tv_dst, double *offset, double *precision, - double *root_dispersion + double *synch_distance ) { l_fp p_rec, p_xmt, p_ref, p_org, tmp, dst; @@ -1255,12 +1255,13 @@ offset_calculation( *precision = LOGTOD(rpkt->precision); TRACE(3, ("offset_calculation: precision: %f\n", *precision)); - *root_dispersion = FPTOD(p_rdsp); + *synch_distance = (FPTOD(p_rdly) + FPTOD(p_rdsp))/2.0; #ifdef DEBUG if (debug > 2) { printf("sntp rootdelay: %f\n", FPTOD(p_rdly)); - printf("sntp rootdisp: %f\n", *root_dispersion); + printf("sntp rootdisp: %f\n", FPTOD(p_rdsp)); + printf("sntp syncdist: %f\n", *synch_distance); pkt_output(rpkt, rpktl, stdout); @@ -1477,9 +1478,7 @@ gettimeofday_cached( if (labs((long)diff.tv_sec) < 3600) { /* older libevent2 using monotonic */ timeval_sub(&offset, &systemt, &mono); - msyslog(LOG_NOTICE, - "Offsetting CLOCK_MONOTONIC times by %+ld.%06ld\n", - (long)offset.tv_sec, offset.tv_usec); + TRACE(1, ("%s: Offsetting libevent CLOCK_MONOTONIC times by %.6f\n", progname, offset)); } } offset_ready = TRUE;