]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
driftfile maintenance changes from Dave Mills. Use clock_phi instead of stats_write_...
authorHarlan Stenn <stenn@ntp.org>
Thu, 7 Jun 2007 10:40:49 +0000 (06:40 -0400)
committerHarlan Stenn <stenn@ntp.org>
Thu, 7 Jun 2007 10:40:49 +0000 (06:40 -0400)
bk: 4667e0b1Vaag-WIc-mfA2YrZ9ECe3A

ChangeLog
ntpd/ntp_util.c
ntpd/ntpd.c

index 070b1a5d1809a9c058889dfa4b9b4bc177ff50b8..e452d199022d70fd35a861c9f7e10ed0ae385867 100644 (file)
--- 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.
index 6c2fdce4d9a569fd899f83b08718602271f68f08..ac55ad0e0b730144522b486b7f97bc34c91ec8e2 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * ntp_util.c - stuff I didn't have any other place for
  */
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #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:
index da27b1e1f598a7c3edf26aead73e8f98e7d10ab6..3118b2b9a25d0767d5d98fd95809825fbf120e0c 100644 (file)
@@ -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 */