From: Harlan Stenn Date: Tue, 4 May 2004 05:01:59 +0000 (-0400) Subject: Cleanup/fixes from Dave Mills. X-Git-Tag: NTP_4_2_3~168^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=381eeb8dbb67f924c26a0c77c74f145c140bba57;p=thirdparty%2Fntp.git Cleanup/fixes from Dave Mills. bk: 409723c7JZERYM5976JaMqnGcOWGwA --- diff --git a/include/ntpd.h b/include/ntpd.h index b45b371f1..a789d0f9c 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -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 */ diff --git a/ntpd/ntp_filegen.c b/ntpd/ntp_filegen.c index 59a1d91ba..c7fcbc4b4 100644 --- a/ntpd/ntp_filegen.c +++ b/ntpd/ntp_filegen.c @@ -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); } } diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index df3bfc6ca..01f7e50e2 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -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