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:
parent
1b8deaf354
commit
9a01ccc07f
4 changed files with 60 additions and 3 deletions
30
chrony.texi
30
chrony.texi
|
@ -1173,6 +1173,7 @@ directives can occur in any order in the file.
|
|||
* cmdallow directive:: Give control access to chronyc on other computers
|
||||
* cmddeny directive:: Deny control access to chronyc on other computers
|
||||
* commandkey directive:: Set runtime command key
|
||||
* corrtimeratio directive:: Set correction time ratio
|
||||
* cmdport directive:: Set port to use for runtime commanding
|
||||
* deny directive:: Deny access to NTP clients
|
||||
* driftfile directive:: Specify location of file containing drift data
|
||||
|
@ -1493,6 +1494,35 @@ cmdport 257
|
|||
This would make @code{chronyd} use 257/udp as its command port.
|
||||
(@code{chronyc} would need to be run with the @code{-p 257} switch to
|
||||
inter-operate correctly).
|
||||
@c }}}
|
||||
@c {{{ corrtimeratio
|
||||
@node corrtimeratio directive
|
||||
@subsection corrtimeratio
|
||||
When @code{chronyd} makes a time correction, it controls how quickly
|
||||
the system clock is slewed (so far only on Linux). This rate
|
||||
temporarily affects the frequency error of the system clock.
|
||||
|
||||
The @code{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 @code{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.
|
||||
|
||||
The syntax is
|
||||
|
||||
@example
|
||||
corrtimeratio 10
|
||||
@end example
|
||||
|
||||
@c }}}
|
||||
@c {{{ deny
|
||||
@node deny directive
|
||||
|
|
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)
|
||||
{
|
||||
|
|
1
conf.h
1
conf.h
|
@ -74,6 +74,7 @@ extern void CNF_GetLinuxFreqScale(int *set, double *freq_scale);
|
|||
/* Value returned in ppm, as read from file */
|
||||
extern double CNF_GetMaxUpdateSkew(void);
|
||||
extern double CNF_GetMaxClockError(void);
|
||||
extern double CNF_GetCorrectionTimeRatio(void);
|
||||
|
||||
extern double CNF_GetReselectDistance(void);
|
||||
extern double CNF_GetStratumWeight(void);
|
||||
|
|
11
reference.c
11
reference.c
|
@ -56,6 +56,8 @@ static double our_root_dispersion;
|
|||
|
||||
static double max_update_skew;
|
||||
|
||||
static double correction_time_ratio;
|
||||
|
||||
/* Flag indicating that we are initialised */
|
||||
static int initialised = 0;
|
||||
|
||||
|
@ -181,6 +183,8 @@ REF_Initialise(void)
|
|||
|
||||
max_update_skew = fabs(CNF_GetMaxUpdateSkew()) * 1.0e-6;
|
||||
|
||||
correction_time_ratio = CNF_GetCorrectionTimeRatio();
|
||||
|
||||
enable_local_stratum = CNF_AllowLocalReference(&local_stratum);
|
||||
|
||||
CNF_GetMakeStep(&make_step_limit, &make_step_threshold);
|
||||
|
@ -619,13 +623,14 @@ REF_SetReference(int stratum,
|
|||
Define correction rate as the area of the region bounded by the graph of
|
||||
offset corrected in time. Set the rate so that the time needed to correct
|
||||
an offset equal to the current sourcestats stddev will be equal to the
|
||||
update interval (assuming linear adjustment). The offset and the
|
||||
time needed to make the correction are inversely proportional.
|
||||
update interval multiplied by the correction time ratio (assuming linear
|
||||
adjustment). The offset and the time needed to make the correction are
|
||||
inversely proportional.
|
||||
|
||||
This is only a suggestion and it's up to the system driver how the
|
||||
adjustment will be executed. */
|
||||
|
||||
correction_rate = 0.5 * offset_sd * update_interval;
|
||||
correction_rate = correction_time_ratio * 0.5 * offset_sd * update_interval;
|
||||
|
||||
/* Eliminate updates that are based on totally unreliable frequency
|
||||
information */
|
||||
|
|
Loading…
Reference in a new issue