mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 23:55:07 -05:00
sources: add configurable limit for jitter
The maxjitter directive sets the maximum allowed jitter of the sources to not be rejected by the source selection algorithm. This prevents synchronisation with sources that have a small root distance, but their time is too variable. By default, the maximum jitter is 1 second.
This commit is contained in:
10
sources.c
10
sources.c
@@ -71,12 +71,12 @@ typedef enum {
|
||||
SRC_UNSELECTABLE, /* Has noselect option set */
|
||||
SRC_BAD_STATS, /* Doesn't have valid stats data */
|
||||
SRC_BAD_DISTANCE, /* Has root distance longer than allowed maximum */
|
||||
SRC_JITTERY, /* Had std dev larger than allowed maximum */
|
||||
SRC_WAITS_STATS, /* Others have bad stats, selection postponed */
|
||||
SRC_STALE, /* Has older samples than others */
|
||||
SRC_ORPHAN, /* Has stratum equal or larger than orphan stratum */
|
||||
SRC_UNTRUSTED, /* Overlaps trusted sources */
|
||||
SRC_FALSETICKER, /* Doesn't agree with others */
|
||||
SRC_JITTERY, /* Scatter worse than other's dispersion (not used) */
|
||||
SRC_WAITS_SOURCES, /* Not enough sources, selection postponed */
|
||||
SRC_NONPREFERRED, /* Others have prefer option */
|
||||
SRC_WAITS_UPDATE, /* No updates, selection postponed */
|
||||
@@ -159,6 +159,7 @@ static int selected_source_index; /* Which source index is currently
|
||||
#define DISTANT_PENALTY 32
|
||||
|
||||
static double max_distance;
|
||||
static double max_jitter;
|
||||
static double reselect_distance;
|
||||
static double stratum_weight;
|
||||
static double combine_limit;
|
||||
@@ -184,6 +185,7 @@ void SRC_Initialise(void) {
|
||||
max_n_sources = 0;
|
||||
selected_source_index = INVALID_SOURCE;
|
||||
max_distance = CNF_GetMaxDistance();
|
||||
max_jitter = CNF_GetMaxJitter();
|
||||
reselect_distance = CNF_GetReselectDistance();
|
||||
stratum_weight = CNF_GetStratumWeight();
|
||||
combine_limit = CNF_GetCombineLimit();
|
||||
@@ -665,6 +667,12 @@ SRC_SelectSource(SRC_Instance updated_inst)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* And the same applies for the estimated standard deviation */
|
||||
if (si->std_dev > max_jitter) {
|
||||
sources[i]->status = SRC_JITTERY;
|
||||
continue;
|
||||
}
|
||||
|
||||
sources[i]->status = SRC_OK; /* For now */
|
||||
|
||||
if (sources[i]->reachability && max_reach_sample_ago < first_sample_ago)
|
||||
|
||||
Reference in New Issue
Block a user