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 */
* 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);
}
}
* 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) {
/*
- * 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(
)
{
state = trans;
- last_time = current_time;
+ last_time = sys_clocktime;
last_base = offset - clock_offset;
last_offset = clock_offset = offset;
#ifdef DEBUG