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:
parent
d5e645eb38
commit
55717c1ccd
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue