mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 19:05:06 -05:00
Add corrtimeratio directive
The corrtimeratio directive controls the ratio between the duration in which the clock is slewed for an average correction according to the source history and the interval in which the corrections are done (usually the NTP polling interval). Corrections larger than the average take less time and smaller corrections take more time, the amount of the correction and the correction time are inversely proportional. Increasing corrtimeratio makes the overall frequency error of the system clock smaller, but increases the overall time error as the corrections will take longer. By default, the ratio is 1, which means the duration of an average correction will be close to the update interval.
This commit is contained in:
21
conf.c
21
conf.c
@@ -76,6 +76,7 @@ static void parse_logbanner(const char *);
|
||||
static void parse_logdir(const char *);
|
||||
static void parse_maxupdateskew(const char *);
|
||||
static void parse_maxclockerror(const char *);
|
||||
static void parse_corrtimeratio(const char *);
|
||||
static void parse_reselectdist(const char *);
|
||||
static void parse_stratumweight(const char *);
|
||||
static void parse_peer(const char *);
|
||||
@@ -122,6 +123,7 @@ static char *drift_file = NULL;
|
||||
static char *rtc_file = NULL;
|
||||
static unsigned long command_key_id;
|
||||
static double max_update_skew = 1000.0;
|
||||
static double correction_time_ratio = 1.0;
|
||||
static double max_clock_error = 1.0; /* in ppm */
|
||||
|
||||
static double reselect_distance = 1e-4;
|
||||
@@ -239,6 +241,7 @@ static const Command commands[] = {
|
||||
{"dumpdir", 7, parse_dumpdir},
|
||||
{"maxupdateskew", 13, parse_maxupdateskew},
|
||||
{"maxclockerror", 13, parse_maxclockerror},
|
||||
{"corrtimeratio", 13, parse_corrtimeratio},
|
||||
{"commandkey", 10, parse_commandkey},
|
||||
{"initstepslew", 12, parse_initstepslew},
|
||||
{"local", 5, parse_local},
|
||||
@@ -632,6 +635,16 @@ parse_maxclockerror(const char *line)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_corrtimeratio(const char *line)
|
||||
{
|
||||
if (sscanf(line, "%lf", &correction_time_ratio) != 1) {
|
||||
LOG(LOGS_WARN, LOGF_Configure, "Could not read correction time ratio at line %d", line_number);
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_reselectdist(const char *line)
|
||||
{
|
||||
@@ -1477,6 +1490,14 @@ CNF_GetMaxClockError(void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
double
|
||||
CNF_GetCorrectionTimeRatio(void)
|
||||
{
|
||||
return correction_time_ratio;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
double
|
||||
CNF_GetReselectDistance(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user