mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
Add refclock option for delay
This is useful when refclocks don't agree on time, increasing the delay will widen the interval used in the source selection algorithm.
This commit is contained in:
7
conf.c
7
conf.c
@@ -431,7 +431,7 @@ parse_refclock(const char *line)
|
||||
{
|
||||
int i, n, poll, dpoll, filter_length;
|
||||
unsigned long ref_id;
|
||||
double offset;
|
||||
double offset, delay;
|
||||
const char *tmp;
|
||||
char name[5], cmd[10 + 1], *param;
|
||||
unsigned char ref[5];
|
||||
@@ -444,6 +444,7 @@ parse_refclock(const char *line)
|
||||
dpoll = 0;
|
||||
filter_length = 15;
|
||||
offset = 0.0;
|
||||
delay = 1e-9;
|
||||
ref_id = 0;
|
||||
|
||||
if (sscanf(line, "%4s%n", name, &n) != 1) {
|
||||
@@ -488,6 +489,9 @@ parse_refclock(const char *line)
|
||||
} else if (!strncasecmp(cmd, "offset", 6)) {
|
||||
if (sscanf(line, "%lf%n", &offset, &n) != 1)
|
||||
break;
|
||||
} else if (!strncasecmp(cmd, "delay", 5)) {
|
||||
if (sscanf(line, "%lf%n", &delay, &n) != 1)
|
||||
break;
|
||||
} else {
|
||||
LOG(LOGS_WARN, LOGF_Configure, "Unknown refclock parameter %s at line %d", cmd, line_number);
|
||||
break;
|
||||
@@ -501,6 +505,7 @@ parse_refclock(const char *line)
|
||||
refclock_sources[i].poll = poll;
|
||||
refclock_sources[i].filter_length = filter_length;
|
||||
refclock_sources[i].offset = offset;
|
||||
refclock_sources[i].delay = delay;
|
||||
refclock_sources[i].ref_id = ref_id;
|
||||
|
||||
n_refclock_sources++;
|
||||
|
||||
@@ -62,6 +62,7 @@ struct RCL_Instance_Record {
|
||||
struct MedianFilter filter;
|
||||
unsigned long ref_id;
|
||||
double offset;
|
||||
double delay;
|
||||
SCH_TimeoutID timeout_id;
|
||||
SRC_Instance source;
|
||||
};
|
||||
@@ -132,6 +133,7 @@ RCL_AddRefclock(RefclockParameters *params)
|
||||
inst->driver_polled = 0;
|
||||
inst->leap_status = 0;
|
||||
inst->offset = params->offset;
|
||||
inst->delay = params->delay;
|
||||
inst->timeout_id = -1;
|
||||
inst->source = NULL;
|
||||
|
||||
@@ -269,7 +271,7 @@ poll_timeout(void *arg)
|
||||
#endif
|
||||
SRC_SetReachable(inst->source);
|
||||
SRC_AccumulateSample(inst->source, &sample_time, offset,
|
||||
1e-9, dispersion, 1e-9, dispersion, 0, inst->leap_status);
|
||||
inst->delay, dispersion, inst->delay, dispersion, 0, inst->leap_status);
|
||||
inst->missed_samples = 0;
|
||||
} else {
|
||||
inst->missed_samples++;
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef struct {
|
||||
int filter_length;
|
||||
unsigned long ref_id;
|
||||
double offset;
|
||||
double delay;
|
||||
} RefclockParameters;
|
||||
|
||||
typedef struct RCL_Instance_Record *RCL_Instance;
|
||||
|
||||
Reference in New Issue
Block a user