From: Harlan Stenn Date: Thu, 7 Jun 2007 10:40:49 +0000 (-0400) Subject: driftfile maintenance changes from Dave Mills. Use clock_phi instead of stats_write_... X-Git-Tag: NTP_4_2_5P46~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7bd6aa98823f06d0c4da9ee9b21ab45b5506cf1;p=thirdparty%2Fntp.git driftfile maintenance changes from Dave Mills. Use clock_phi instead of stats_write_tolerance bk: 4667e0b1Vaag-WIc-mfA2YrZ9ECe3A --- diff --git a/ChangeLog b/ChangeLog index 070b1a5d1..e452d1990 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* driftfile maintenance changes from Dave Mills. Use clock_phi instead of + stats_write_tolerance. * [Bug 828] refid string not being parsed correctly. * [Bug 846] Correct includefile parsing. * [Bug 827] New parsing code does not handle "fudge" correctly. diff --git a/ntpd/ntp_util.c b/ntpd/ntp_util.c index 6c2fdce4d..ac55ad0e0 100644 --- a/ntpd/ntp_util.c +++ b/ntpd/ntp_util.c @@ -1,7 +1,6 @@ /* * ntp_util.c - stuff I didn't have any other place for */ - #ifdef HAVE_CONFIG_H # include #endif @@ -54,8 +53,7 @@ static char *key_file_name; static char *stats_drift_file; static char *stats_temp_file; int stats_write_period = 3600; /* # of seconds between writes. */ -double stats_write_tolerance = 0; -static double prev_drift_comp = 99999.; +static double prev_drift_comp; /* * Statistics file stuff @@ -106,17 +104,11 @@ init_util(void) stats_drift_file = 0; stats_temp_file = 0; key_file_name = 0; - filegen_register(&statsdir[0], "peerstats", &peerstats); - filegen_register(&statsdir[0], "loopstats", &loopstats); - filegen_register(&statsdir[0], "clockstats", &clockstats); - filegen_register(&statsdir[0], "rawstats", &rawstats); - filegen_register(&statsdir[0], "sysstats", &sysstats); - #ifdef OPENSSL filegen_register(&statsdir[0], "cryptostats", &cryptostats); #endif /* OPENSSL */ @@ -215,10 +207,9 @@ write_stats(void) record_sys_stats(); - if ((u_long)(fabs(prev_drift_comp - drift_comp) * 1e9) <= - (u_long)(fabs(stats_write_tolerance * drift_comp) * 1e9)) { - return; - } + if (fabs(prev_drift_comp - drift_comp) > clock_phi) + return; + prev_drift_comp = drift_comp; if (stats_drift_file != 0) { if (state == 4) { @@ -352,12 +343,14 @@ stats_config( old_drift = 1e9; fclose(fp); break; + } fclose(fp); - prev_drift_comp = old_drift / 1e6; + old_drift /= 1e6; + prev_drift_comp = old_drift; msyslog(LOG_INFO, "frequency initialized %.3f PPM from %s", - old_drift, stats_drift_file); + old_drift * 1e6, stats_drift_file); break; case STATS_STATSDIR: diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index da27b1e1f..3118b2b9a 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -840,7 +840,7 @@ ntpdmain( getconfig(argc, argv); - loop_config(LOOP_DRIFTCOMP, old_drift / 1e6); + loop_config(LOOP_DRIFTCOMP, old_drift); #ifdef OPENSSL crypto_setup(); #endif /* OPENSSL */