mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
Update offset correction errors only when needed
This commit is contained in:
7
local.c
7
local.c
@@ -349,13 +349,8 @@ LCL_CookTime(struct timeval *raw, struct timeval *cooked, double *err)
|
||||
void
|
||||
LCL_GetOffsetCorrection(struct timeval *raw, double *correction, double *err)
|
||||
{
|
||||
double e;
|
||||
|
||||
/* Call system specific driver to get correction */
|
||||
(*drv_offset_convert)(raw, correction, &e);
|
||||
|
||||
if (err)
|
||||
*err = e;
|
||||
(*drv_offset_convert)(raw, correction, err);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
@@ -800,7 +800,6 @@ get_offset_correction(struct timeval *raw,
|
||||
slow_slewing = 0;
|
||||
}
|
||||
}
|
||||
update_slow_slew_error(offset);
|
||||
|
||||
if (!nano_slewing) {
|
||||
noffset = 0;
|
||||
@@ -812,7 +811,6 @@ get_offset_correction(struct timeval *raw,
|
||||
nano_slewing = 0;
|
||||
}
|
||||
}
|
||||
update_nano_slew_error(noffset, 0);
|
||||
|
||||
if (fast_slewing) {
|
||||
UTI_DiffTimevalsToDouble(&fast_slew_duration, raw, &slew_start_tv);
|
||||
@@ -824,7 +822,12 @@ get_offset_correction(struct timeval *raw,
|
||||
}
|
||||
|
||||
*corr = - (offset_register + fast_slew_remaining) + offset / 1.0e6 + noffset / 1.0e9;
|
||||
|
||||
if (err) {
|
||||
update_slow_slew_error(offset);
|
||||
update_nano_slew_error(noffset, 0);
|
||||
*err = get_slow_slew_error(raw) + get_fast_slew_error(raw) + get_nano_slew_error();;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -271,6 +271,7 @@ get_offset_correction(struct timeval *raw,
|
||||
stop_adjust();
|
||||
*corr = -offset_register;
|
||||
start_adjust();
|
||||
if (err)
|
||||
*err = 0.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ get_offset_correction(struct timeval *raw,
|
||||
stop_adjust();
|
||||
*corr = -offset_register;
|
||||
start_adjust();
|
||||
if (err)
|
||||
*err = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,6 +287,7 @@ get_offset_correction(struct timeval *raw,
|
||||
stop_adjust();
|
||||
*corr = -offset_register;
|
||||
start_adjust();
|
||||
if (err)
|
||||
*err = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user