mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
refclock: trim offset in local mode
With the local option, trim offset larger than 1 second to not lose precision after large steps of the clock.
This commit is contained in:
@@ -757,6 +757,12 @@ follow_local(RCL_Instance inst, struct timespec *prev_ref_time, double prev_freq
|
|||||||
LCL_ReadCookedTime(&now, NULL);
|
LCL_ReadCookedTime(&now, NULL);
|
||||||
SST_SlewSamples(stats, &now, dfreq, doffset);
|
SST_SlewSamples(stats, &now, dfreq, doffset);
|
||||||
SPF_SlewSamples(inst->filter, &now, dfreq, doffset);
|
SPF_SlewSamples(inst->filter, &now, dfreq, doffset);
|
||||||
|
|
||||||
|
/* Keep the offset close to zero to not lose precision */
|
||||||
|
if (fabs(offset) >= 1.0) {
|
||||||
|
SST_CorrectOffset(stats, -round(offset));
|
||||||
|
SPF_CorrectOffset(inst->filter, -round(offset));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user