Add makestep directive

This commit is contained in:
Miroslav Lichvar
2010-01-25 15:33:56 +01:00
parent 15e154c09d
commit 8a00758cf5
7 changed files with 89 additions and 10 deletions

View File

@@ -555,10 +555,10 @@ lcl_RegisterSystemDrivers(lcl_ReadFrequencyDriver read_freq,
/* ================================================== */
/* Look at the current difference between the system time and the NTP
time, and make a step to cancel it. */
time, and make a step to cancel it if it's larger than the threshold. */
int
LCL_MakeStep(void)
LCL_MakeStep(double threshold)
{
struct timeval raw;
double correction;
@@ -566,6 +566,9 @@ LCL_MakeStep(void)
LCL_ReadRawTime(&raw);
correction = LCL_GetOffsetCorrection(&raw);
if (fabs(correction) <= threshold)
return 0;
/* Cancel remaining slew and make the step */
LCL_AccumulateOffset(correction);
LCL_ApplyStepOffset(-correction);