mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 23:35:07 -05:00
reference: return real sync status in REF_GetReferenceParams()
If local reference is active, return normal leap, but unsynchronised status. Update the callers of the function to work with the leap directly and not change their behaviour. REF_IsLocalActive() is no longer needed.
This commit is contained in:
12
refclock.c
12
refclock.c
@@ -470,15 +470,16 @@ RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second)
|
||||
double root_delay, root_dispersion, distance;
|
||||
uint32_t ref_id;
|
||||
|
||||
/* Ignore the pulse if we are not well synchronized */
|
||||
/* Ignore the pulse if we are not well synchronized and the local
|
||||
reference is not active */
|
||||
|
||||
REF_GetReferenceParams(&cooked_time, &is_synchronised, &leap, &stratum,
|
||||
&ref_id, &ref_time, &root_delay, &root_dispersion);
|
||||
distance = fabs(root_delay) / 2 + root_dispersion;
|
||||
|
||||
if (!is_synchronised || distance >= 0.5 / rate) {
|
||||
if (leap == LEAP_Unsynchronised || distance >= 0.5 / rate) {
|
||||
DEBUG_LOG(LOGF_Refclock, "refclock pulse ignored second=%.9f sync=%d dist=%.9f",
|
||||
second, is_synchronised, distance);
|
||||
second, leap != LEAP_Unsynchronised, distance);
|
||||
/* Drop also all stored samples */
|
||||
filter_reset(&instance->filter);
|
||||
return 0;
|
||||
@@ -528,9 +529,10 @@ pps_stratum(RCL_Instance instance, struct timeval *tv)
|
||||
REF_GetReferenceParams(tv, &is_synchronised, &leap, &stratum,
|
||||
&ref_id, &ref_time, &root_delay, &root_dispersion);
|
||||
|
||||
/* Don't change our stratum if local stratum is active
|
||||
/* Don't change our stratum if the local reference is active
|
||||
or this is the current source */
|
||||
if (ref_id == instance->ref_id || REF_IsLocalActive())
|
||||
if (ref_id == instance->ref_id ||
|
||||
(!is_synchronised && leap != LEAP_Unsynchronised))
|
||||
return stratum - 1;
|
||||
|
||||
/* Or the current source is another PPS refclock */
|
||||
|
||||
Reference in New Issue
Block a user