mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
Add macro for maximum fastslew timeout
This commit is contained in:
12
sys_linux.c
12
sys_linux.c
@@ -174,6 +174,9 @@ static SCH_TimeoutID slew_timeout_id;
|
|||||||
a fast slew */
|
a fast slew */
|
||||||
static double delta_total_tick;
|
static double delta_total_tick;
|
||||||
|
|
||||||
|
/* Maximum length of one fast slew */
|
||||||
|
#define MAX_FASTSLEW_TIMEOUT (3600 * 24 * 7)
|
||||||
|
|
||||||
/* Max amount of time that we wish to slew by using adjtime (or its
|
/* Max amount of time that we wish to slew by using adjtime (or its
|
||||||
equivalent). If more than this is outstanding, we alter the value
|
equivalent). If more than this is outstanding, we alter the value
|
||||||
of tick instead, for a set period. Set this according to the
|
of tick instead, for a set period. Set this according to the
|
||||||
@@ -405,8 +408,8 @@ adjust_fast_slew(double old_tick, double old_delta_tick)
|
|||||||
|
|
||||||
dseconds = -offset_register * (current_total_tick + delta_total_tick) / delta_total_tick;
|
dseconds = -offset_register * (current_total_tick + delta_total_tick) / delta_total_tick;
|
||||||
|
|
||||||
if (dseconds > 3600 * 24 * 7)
|
if (dseconds > MAX_FASTSLEW_TIMEOUT)
|
||||||
dseconds = 3600 * 24 * 7;
|
dseconds = MAX_FASTSLEW_TIMEOUT;
|
||||||
UTI_AddDoubleToTimeval(&tv, dseconds, &end_of_slew);
|
UTI_AddDoubleToTimeval(&tv, dseconds, &end_of_slew);
|
||||||
|
|
||||||
slew_start_tv = tv;
|
slew_start_tv = tv;
|
||||||
@@ -542,9 +545,8 @@ initiate_slew(void)
|
|||||||
fast_slewing = 1;
|
fast_slewing = 1;
|
||||||
slew_start_tv = T0;
|
slew_start_tv = T0;
|
||||||
|
|
||||||
/* Set up timeout for end of slew, limit to one week */
|
if (dseconds > MAX_FASTSLEW_TIMEOUT)
|
||||||
if (dseconds > 3600 * 24 * 7)
|
dseconds = MAX_FASTSLEW_TIMEOUT;
|
||||||
dseconds = 3600 * 24 * 7;
|
|
||||||
UTI_AddDoubleToTimeval(&T0, dseconds, &end_of_slew);
|
UTI_AddDoubleToTimeval(&T0, dseconds, &end_of_slew);
|
||||||
|
|
||||||
slew_timeout_id = SCH_AddTimeout(&end_of_slew, handle_end_of_slew, NULL);
|
slew_timeout_id = SCH_AddTimeout(&end_of_slew, handle_end_of_slew, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user