mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 23:25:07 -05:00
reference: cook timestamp when setting reference
This is a partial revert of 8aa9eb19c8.
With the new generic driver cooking is cheap and it should be slighly
more accurate than reusing offset correction from the scheduler
timestamps.
This commit is contained in:
13
reference.c
13
reference.c
@@ -791,7 +791,7 @@ REF_SetReference(int stratum,
|
|||||||
double elapsed;
|
double elapsed;
|
||||||
double correction_rate;
|
double correction_rate;
|
||||||
double uncorrected_offset;
|
double uncorrected_offset;
|
||||||
struct timeval now, raw_now, ev_now, ev_raw_now;
|
struct timeval now, raw_now;
|
||||||
|
|
||||||
assert(initialised);
|
assert(initialised);
|
||||||
|
|
||||||
@@ -824,10 +824,7 @@ REF_SetReference(int stratum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LCL_ReadRawTime(&raw_now);
|
LCL_ReadRawTime(&raw_now);
|
||||||
|
LCL_GetOffsetCorrection(&raw_now, &uncorrected_offset, NULL);
|
||||||
/* This is cheaper than calling LCL_CookTime */
|
|
||||||
SCH_GetLastEventTime(&ev_now, NULL, &ev_raw_now);
|
|
||||||
UTI_DiffTimevalsToDouble(&uncorrected_offset, &ev_now, &ev_raw_now);
|
|
||||||
UTI_AddDoubleToTimeval(&raw_now, uncorrected_offset, &now);
|
UTI_AddDoubleToTimeval(&raw_now, uncorrected_offset, &now);
|
||||||
|
|
||||||
UTI_DiffTimevalsToDouble(&elapsed, &now, ref_time);
|
UTI_DiffTimevalsToDouble(&elapsed, &now, ref_time);
|
||||||
@@ -998,9 +995,9 @@ REF_SetUnsynchronised(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is cheaper than calling LCL_CookTime */
|
LCL_ReadRawTime(&now_raw);
|
||||||
SCH_GetLastEventTime(&now, NULL, &now_raw);
|
LCL_GetOffsetCorrection(&now_raw, &uncorrected_offset, NULL);
|
||||||
UTI_DiffTimevalsToDouble(&uncorrected_offset, &now, &now_raw);
|
UTI_AddDoubleToTimeval(&now_raw, uncorrected_offset, &now);
|
||||||
|
|
||||||
if (fb_drifts) {
|
if (fb_drifts) {
|
||||||
schedule_fb_drift(&now);
|
schedule_fb_drift(&now);
|
||||||
|
|||||||
Reference in New Issue
Block a user