Call maybe_log_offset and update_leap_status after adjusting clock
This commit is contained in:
parent
8d80ce444f
commit
57f8160d6c
1 changed files with 3 additions and 7 deletions
10
reference.c
10
reference.c
|
@ -457,12 +457,11 @@ schedule_fb_drift(struct timeval *now)
|
||||||
#define S_MAX_USER_LEN "128"
|
#define S_MAX_USER_LEN "128"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_log_offset(double offset)
|
maybe_log_offset(double offset, time_t now)
|
||||||
{
|
{
|
||||||
double abs_offset;
|
double abs_offset;
|
||||||
FILE *p;
|
FILE *p;
|
||||||
char buffer[BUFLEN], host[BUFLEN];
|
char buffer[BUFLEN], host[BUFLEN];
|
||||||
time_t now;
|
|
||||||
struct tm stm;
|
struct tm stm;
|
||||||
|
|
||||||
abs_offset = fabs(offset);
|
abs_offset = fabs(offset);
|
||||||
|
@ -484,7 +483,6 @@ maybe_log_offset(double offset)
|
||||||
}
|
}
|
||||||
fprintf(p, "Subject: chronyd reports change to system clock on node [%s]\n", host);
|
fprintf(p, "Subject: chronyd reports change to system clock on node [%s]\n", host);
|
||||||
fputs("\n", p);
|
fputs("\n", p);
|
||||||
now = time(NULL);
|
|
||||||
stm = *localtime(&now);
|
stm = *localtime(&now);
|
||||||
strftime(buffer, sizeof(buffer), "On %A, %d %B %Y\n with the system clock reading %H:%M:%S (%Z)", &stm);
|
strftime(buffer, sizeof(buffer), "On %A, %d %B %Y\n with the system clock reading %H:%M:%S (%Z)", &stm);
|
||||||
fputs(buffer, p);
|
fputs(buffer, p);
|
||||||
|
@ -733,8 +731,6 @@ REF_SetReference(int stratum,
|
||||||
our_root_delay = root_delay;
|
our_root_delay = root_delay;
|
||||||
our_root_dispersion = root_dispersion;
|
our_root_dispersion = root_dispersion;
|
||||||
|
|
||||||
update_leap_status(leap, raw_now.tv_sec);
|
|
||||||
|
|
||||||
if (last_ref_update.tv_sec) {
|
if (last_ref_update.tv_sec) {
|
||||||
UTI_DiffTimevalsToDouble(&update_interval, &now, &last_ref_update);
|
UTI_DiffTimevalsToDouble(&update_interval, &now, &last_ref_update);
|
||||||
if (update_interval < 0.0)
|
if (update_interval < 0.0)
|
||||||
|
@ -793,7 +789,6 @@ REF_SetReference(int stratum,
|
||||||
|
|
||||||
our_residual_freq = new_freq - our_frequency;
|
our_residual_freq = new_freq - our_frequency;
|
||||||
|
|
||||||
maybe_log_offset(our_offset);
|
|
||||||
LCL_AccumulateFrequencyAndOffset(our_frequency, our_offset, correction_rate);
|
LCL_AccumulateFrequencyAndOffset(our_frequency, our_offset, correction_rate);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -801,12 +796,13 @@ REF_SetReference(int stratum,
|
||||||
#if 0
|
#if 0
|
||||||
LOG(LOGS_INFO, LOGF_Reference, "Skew %f too large to track, offset=%f", skew, our_offset);
|
LOG(LOGS_INFO, LOGF_Reference, "Skew %f too large to track, offset=%f", skew, our_offset);
|
||||||
#endif
|
#endif
|
||||||
maybe_log_offset(our_offset);
|
|
||||||
LCL_AccumulateOffset(our_offset, correction_rate);
|
LCL_AccumulateOffset(our_offset, correction_rate);
|
||||||
|
|
||||||
our_residual_freq = frequency;
|
our_residual_freq = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_leap_status(leap, raw_now.tv_sec);
|
||||||
|
maybe_log_offset(our_offset, raw_now.tv_sec);
|
||||||
maybe_make_step();
|
maybe_make_step();
|
||||||
|
|
||||||
abs_freq_ppm = LCL_ReadAbsoluteFrequency();
|
abs_freq_ppm = LCL_ReadAbsoluteFrequency();
|
||||||
|
|
Loading…
Reference in a new issue