]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
internal driftfile write control: drift_file_sw
authorHarlan Stenn <stenn@ntp.org>
Tue, 24 Jul 2007 19:01:03 +0000 (15:01 -0400)
committerHarlan Stenn <stenn@ntp.org>
Tue, 24 Jul 2007 19:01:03 +0000 (15:01 -0400)
bk: 46a64c6fpruyFWEeV_6Ku9K2y_oHgA

ChangeLog
include/ntpd.h
ntpd/ntp_config.c
ntpd/ntp_loopfilter.c
ntpd/ntp_util.c

index 658646329de7cbc4357c4710d07d03f80bfcde9f..9203a574c817ba16f9457ebf902aae824532d12d 100644 (file)
--- 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
index 68b90134fba41331bdfbcc3e553dd927ddc7d3c1..f6913f7a897bf816ed13f78612376e339ce910ff 100644 (file)
@@ -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.
index 4f16d9b9e803327185ff8d906790e492c90f83ff..065fe194f88f8c97b73685dbfe9fad2fc196b653 100644 (file)
@@ -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) 
index 267da6651272536273bc56360efc045507c2ead2..e19327c605fff93ae05224a38b277ad7954e853f 100644 (file)
@@ -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
index 77dae40734bdca72baffeb57e5fb2e67d00c3e67..8dd242779d9f7499202597cd24db45a202ba8366 100644 (file)
@@ -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",