+* 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
#endif
extern int sock_hash (struct sockaddr_storage *);
extern double old_drift;
+extern int drift_file_sw;
/*
* Variable declarations for ntpd.
/*
* 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
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
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",