parse_refclock(char *line)
{
int n, poll, dpoll, filter_length, pps_rate, min_samples, max_samples, sel_options;
+ int max_lock_age;
uint32_t ref_id, lock_ref_id;
double offset, delay, precision, max_dispersion;
char *p, *cmd, *name, *param;
precision = 0.0;
max_dispersion = 0.0;
ref_id = 0;
+ max_lock_age = 2;
lock_ref_id = 0;
if (!*line) {
} else if (!strcasecmp(cmd, "minsamples")) {
if (sscanf(line, "%d%n", &min_samples, &n) != 1)
break;
+ } else if (!strcasecmp(cmd, "maxlockage")) {
+ if (sscanf(line, "%d%n", &max_lock_age, &n) != 1)
+ break;
} else if (!strcasecmp(cmd, "maxsamples")) {
if (sscanf(line, "%d%n", &max_samples, &n) != 1)
break;
refclock->precision = precision;
refclock->max_dispersion = max_dispersion;
refclock->ref_id = ref_id;
+ refclock->max_lock_age = max_lock_age;
refclock->lock_ref_id = lock_ref_id;
}
controls how the pulses will be completed with real time. To actually receive
more than one pulse per second, a negative *dpoll* has to be specified (-3 for
a 5Hz signal). The default is 1.
+*maxlockage* _pulses_:::
+This option specifies in number of pulses how old can be samples from the
+refclock specified by the *lock* option to be paired with the pulses.
+Increasing this value is useful when the samples are produced at a lower rate
+than the pulses. The default is 2.
*offset* _offset_:::
This option can be used to compensate for a constant error. The specified
offset (in seconds) is applied to all samples produced by the reference clock.
int leap_status;
int pps_rate;
int pps_active;
+ int max_lock_age;
struct MedianFilter filter;
uint32_t ref_id;
uint32_t lock_ref;
inst->leap_status = LEAP_Normal;
inst->pps_rate = params->pps_rate;
inst->pps_active = 0;
+ inst->max_lock_age = params->max_lock_age;
inst->lock_ref = params->lock_ref_id;
inst->offset = params->offset;
inst->delay = params->delay;
ref_dispersion += filter_get_avg_sample_dispersion(&lock_refclock->filter);
sample_diff = UTI_DiffTimespecsToDouble(&cooked_time, &ref_sample_time);
- if (fabs(sample_diff) >= 2.0 / rate) {
+ if (fabs(sample_diff) >= (double)instance->max_lock_age / rate) {
DEBUG_LOG(LOGF_Refclock, "refclock pulse ignored samplediff=%.9f",
sample_diff);
return 0;