]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Cleanup/fixes from Dave Mills.
authorHarlan Stenn <stenn@ntp.org>
Tue, 4 May 2004 05:01:59 +0000 (01:01 -0400)
committerHarlan Stenn <stenn@ntp.org>
Tue, 4 May 2004 05:01:59 +0000 (01:01 -0400)
bk: 409723c7JZERYM5976JaMqnGcOWGwA

include/ntpd.h
ntpd/ntp_filegen.c
ntpd/ntp_loopfilter.c

index b45b371f19038621598fc7e1997f7040fb92cebf..a789d0f9c28d31cd1b4a02836125457d7f6ca5bb 100644 (file)
@@ -350,6 +350,7 @@ extern u_char       sys_stratum;            /* stratum of system */
 extern s_char  sys_precision;          /* local clock precision */
 extern double  sys_rootdelay;          /* distance to current sync source */
 extern double  sys_rootdispersion;     /* dispersion of system clock */
+extern u_long  sys_clocktime;          /* last system clock update */
 extern u_int32 sys_refid;              /* reference source for local clock */
 extern l_fp    sys_reftime;            /* time we were last updated */
 extern struct peer *sys_peer;          /* our current peer */
index 59a1d91bae6e68353b75f0a93d15725c444fb773..c7fcbc4b4d20463d09fdf559bae61b981c9661de 100644 (file)
@@ -335,6 +335,11 @@ filegen_setup(
         * reopen new file generation file on change of generation id
         */
        if (gen->fp == NULL || gen->id != new_gen) {
+#if DEBUG
+       if (debug)
+               printf("filegen  %0x %lu %lu %lu\n", gen->type, now,
+                   gen->id, new_gen); 
+#endif
                filegen_open(gen, new_gen);
        }
 }
index df3bfc6ca765969dbf287207c766bce5c8719351..01f7e50e2edd7320b3fd07f0851fe9aee50dddd2 100644 (file)
@@ -321,7 +321,7 @@ local_clock(
         * stepped. 
         */
        clock_frequency = flladj = plladj = 0;
-       mu = current_time - last_time;
+       mu = sys_clocktime - last_time;
        rval = 1;
        if (fabs(fp_offset) > clock_max && clock_max > 0) {
                switch (state) {
@@ -733,7 +733,9 @@ adj_host_clock(
 
 
 /*
- * Clock state machine. Enter new state and set state variables.
+ * Clock state machine. Enter new state and set state variables. Note we
+ * use the time of the last clock filter sample, which may be earlier
+ * than the current time.
  */
 static void
 rstclock(
@@ -742,7 +744,7 @@ rstclock(
        )
 {
        state = trans;
-       last_time = current_time;
+       last_time = sys_clocktime;
        last_base = offset - clock_offset;
        last_offset = clock_offset = offset;
 #ifdef DEBUG