mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:55:07 -05:00
local: reset daemon after unexpected time jump
Add a new change type and use it when an unexpected time jump is detected in the scheduler to reset reference times, offset and slewing, NCR instances (with their polling interval), synchronization status, and drop all sourcestats, manual, refclock and RTC samples. This should make the recovery more graceful if the estimated jump has a large error (e.g. select didn't timeout, or after system suspend).
This commit is contained in:
@@ -87,6 +87,7 @@ static double slew_error;
|
||||
/* ================================================== */
|
||||
|
||||
static void handle_end_of_slew(void *anything);
|
||||
static void update_slew(void);
|
||||
|
||||
/* ================================================== */
|
||||
/* Adjust slew_start on clock step */
|
||||
@@ -95,8 +96,14 @@ static void
|
||||
handle_step(struct timeval *raw, struct timeval *cooked, double dfreq,
|
||||
double doffset, LCL_ChangeType change_type, void *anything)
|
||||
{
|
||||
if (change_type == LCL_ChangeStep)
|
||||
if (change_type == LCL_ChangeUnknownStep) {
|
||||
/* Reset offset and slewing */
|
||||
slew_start = *raw;
|
||||
offset_register = 0.0;
|
||||
update_slew();
|
||||
} else if (change_type == LCL_ChangeStep) {
|
||||
UTI_AddDoubleToTimeval(&slew_start, -doffset, &slew_start);
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
Reference in New Issue
Block a user