mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
refclock: add option to treat non-PPS refclocks as PPS
Add pps option to the refclock directive to force chronyd to treat any refclock as a PPS refclock. This is intended for refclocks that may provide time off by a whole number of seconds due to missing or wrong TAI/GPS->UTC conversion.
This commit is contained in:
@@ -75,6 +75,7 @@ struct RCL_Instance_Record {
|
||||
int driver_polled;
|
||||
int poll;
|
||||
int leap_status;
|
||||
int pps_forced;
|
||||
int pps_rate;
|
||||
int pps_active;
|
||||
int max_lock_age;
|
||||
@@ -198,6 +199,7 @@ RCL_AddRefclock(RefclockParameters *params)
|
||||
inst->poll = params->poll;
|
||||
inst->driver_polled = 0;
|
||||
inst->leap_status = LEAP_Normal;
|
||||
inst->pps_forced = params->pps_forced;
|
||||
inst->pps_rate = params->pps_rate;
|
||||
inst->pps_active = 0;
|
||||
inst->max_lock_age = params->max_lock_age;
|
||||
@@ -362,6 +364,9 @@ RCL_AddSample(RCL_Instance instance, struct timespec *sample_time, double offset
|
||||
double correction, dispersion;
|
||||
struct timespec cooked_time;
|
||||
|
||||
if (instance->pps_forced)
|
||||
return RCL_AddPulse(instance, sample_time, -offset);
|
||||
|
||||
LCL_GetOffsetCorrection(sample_time, &correction, &dispersion);
|
||||
UTI_AddDoubleToTimespec(sample_time, correction, &cooked_time);
|
||||
dispersion += instance->precision;
|
||||
|
||||
Reference in New Issue
Block a user