diff --git a/cmdparse.c b/cmdparse.c index 700da32..c4e26bf 100644 --- a/cmdparse.c +++ b/cmdparse.c @@ -64,6 +64,8 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src) src->params.max_delay = SRC_DEFAULT_MAXDELAY; src->params.max_delay_ratio = SRC_DEFAULT_MAXDELAYRATIO; src->params.max_delay_dev_ratio = SRC_DEFAULT_MAXDELAYDEVRATIO; + src->params.min_delay = 0.0; + src->params.asymmetry = SRC_DEFAULT_ASYMMETRY; src->params.offset = 0.0; hostname = line; @@ -98,6 +100,9 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src) if (sscanf(line, "%"SCNu32"%n", &src->params.authkey, &n) != 1 || src->params.authkey == INACTIVE_AUTHKEY) return 0; + } else if (!strcasecmp(cmd, "asymmetry")) { + if (sscanf(line, "%lf%n", &src->params.asymmetry, &n) != 1) + return 0; } else if (!strcasecmp(cmd, "maxdelay")) { if (sscanf(line, "%lf%n", &src->params.max_delay, &n) != 1) return 0; @@ -116,6 +121,9 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src) } else if (!strcasecmp(cmd, "maxsources")) { if (sscanf(line, "%d%n", &src->params.max_sources, &n) != 1) return 0; + } else if (!strcasecmp(cmd, "mindelay")) { + if (sscanf(line, "%lf%n", &src->params.min_delay, &n) != 1) + return 0; } else if (!strcasecmp(cmd, "minpoll")) { if (sscanf(line, "%d%n", &src->params.minpoll, &n) != 1) return 0; diff --git a/doc/chrony.conf.adoc b/doc/chrony.conf.adoc index b689fb1..7b2ee75 100644 --- a/doc/chrony.conf.adoc +++ b/doc/chrony.conf.adoc @@ -122,6 +122,19 @@ If a measurement has a ratio of the increase in the round-trip delay from the minimum delay amongst the previous measurements to the standard deviation of the previous measurements that is greater than the specified ratio, it will be rejected. The default is 10.0. +*mindelay* _delay_::: +This options specifies a fixed minimum round-trip delay to be used instead of +the minimum amongst the previous measurements. This can be useful in networks +with static configuration to improve the stability of corrections for +asymmetric jitter, weighting of the measurements, and the *maxdelayratio* and +*maxdelaydevratio* tests. The value should be set accurately in order to have a +positive effect on the synchronisation. +*asymmetry* _ratio_::: +This options specifies the asymmetry of the network jitter on the path to the +source, which is used to correct the measured offset according to the delay. +The asymmetry can be between -0.5 and +0.5. A negative value means the delay of +packets sent to the source is more variable than the delay of packets sent from +the source back. By default, *chronyd* estimates the asymmetry automatically. *offset* _offset_::: This option specifies a correction (in seconds) which will be applied to offsets measured with this source. It's particularly useful to compensate for a @@ -1664,11 +1677,11 @@ from the example line above): to be discarded. The number of runs for the data that is being retained is tabulated. Values of approximately half the number of samples are expected. [8] -. The estimated asymmetry of network jitter on the path to the source which was - used to correct the measured offsets. The asymmetry can be between -0.5 and - 0.5. A negative value means the delay of packets sent to the source is - more variable than the delay of packets sent from the source back. [0.00, - i.e. no correction for asymmetry] +. The estimated or configured asymmetry of network jitter on the path to the + source which was used to correct the measured offsets. The asymmetry can be + between -0.5 and +0.5. A negative value means the delay of packets sent to + the source is more variable than the delay of packets sent from the source + back. [0.00, i.e. no correction for asymmetry] + *tracking*::: This option logs changes to the estimate of the system's gain or loss rate, and diff --git a/ntp_core.c b/ntp_core.c index f981953..a198545 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -586,7 +586,7 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar SRC_NTP, params->sel_options, &result->remote_addr.ip_addr, params->min_samples, params->max_samples, - 0.0, 1.0); + params->min_delay, params->asymmetry); result->rx_timeout_id = 0; result->tx_timeout_id = 0; diff --git a/srcparams.h b/srcparams.h index bdf13a8..5bd591d 100644 --- a/srcparams.h +++ b/srcparams.h @@ -48,6 +48,8 @@ typedef struct { double max_delay; double max_delay_ratio; double max_delay_dev_ratio; + double min_delay; + double asymmetry; double offset; } SourceParameters; @@ -63,6 +65,7 @@ typedef struct { #define SRC_DEFAULT_MAXSOURCES 4 #define SRC_DEFAULT_MINSAMPLES (-1) #define SRC_DEFAULT_MAXSAMPLES (-1) +#define SRC_DEFAULT_ASYMMETRY 1.0 #define INACTIVE_AUTHKEY 0 /* Flags for source selection */