From: Harlan Stenn Date: Tue, 24 Jul 2007 19:01:03 +0000 (-0400) Subject: internal driftfile write control: drift_file_sw X-Git-Tag: NTP_4_2_5P61~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f07944528cbd7d81f558523a7bed859317438c43;p=thirdparty%2Fntp.git internal driftfile write control: drift_file_sw bk: 46a64c6fpruyFWEeV_6Ku9K2y_oHgA --- diff --git a/ChangeLog b/ChangeLog index 658646329..9203a574c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Use drift_file_sw internally to control writing the drift file. * Implement the wander_threshold option for the driftfile config keyword. * reformat ntp_control.c; do not use c++ // comments. * [Bug 629] Undo bug #629 fixes as they cause more problems than were being diff --git a/include/ntpd.h b/include/ntpd.h index 68b90134f..f6913f7a8 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -251,6 +251,7 @@ extern void record_timing_stats (const char *); #endif extern int sock_hash (struct sockaddr_storage *); extern double old_drift; +extern int drift_file_sw; /* * Variable declarations for ntpd. diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 4f16d9b9e..065fe194f 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -1921,7 +1921,9 @@ void config_remotely(void) { input_from_file = 0; -// init_syntax_tree(); +#if 0 + init_syntax_tree(); +#endif yyparse(); #ifdef DEBUG if (debug > 1) diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index 267da6651..e19327c60 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -656,10 +656,11 @@ local_clock( /* * Calculate the wander as the exponentially weighted frequency - * differences. + * differences. Enable the frequency file to be written. */ etemp = SQUARE(clock_stability); clock_stability = SQRT(etemp + (dtemp - etemp) / CLOCK_AVG); + drift_file_sw = TRUE; /* * Here we adjust the poll interval by comparing the current diff --git a/ntpd/ntp_util.c b/ntpd/ntp_util.c index 77dae4073..8dd242779 100644 --- a/ntpd/ntp_util.c +++ b/ntpd/ntp_util.c @@ -60,6 +60,7 @@ char *stats_drift_file; /* frequency file name */ static char *stats_temp_file; /* temp frequency file name */ static double wander_resid; /* wander threshold */ double wander_threshold = 1e-7; /* initial wander threshold */ +int drift_file_sw; /* clock update switch */ /* * Statistics file stuff @@ -228,17 +229,18 @@ write_stats(void) if (ftemp > clock_phi) return; - if (stats_drift_file != 0) { + if (stats_drift_file != 0 && drift_file_sw) { /* * When the frequency file is written, initialize the * wander threshold to a configured initial value. - * Thereafter reduce it by a factor of 0.85. When it + * Thereafter reduce it by a factor of 0.5. When it * drops below the frequency wander, write the frequency * file. This adapts to the prevailing wander yet * minimizes the file writes. */ - wander_resid *= 0.8; + drift_file_sw = FALSE; + wander_resid *= 0.5; #ifdef DEBUG if (debug) printf("write_stats: wander %.6lf thresh %.6lf, freq %.6lf\n",