The RTC refclock support both modes of timekeeping (depending on hardware capabilities). As the driver data is const there is a poll callback even in interrupt mode.
So only count poll calls that return non-zero and count provided timestamps in the respecitve functions if they are not called from the driver's poll routine. --- Hello, I'm a bit unsure about this change. I wonder what driver_polled actually should count. If it counts the number off poll calls the logic in RCL_AddCookedPulse and RCL_AddSample are unreliable as they only count the events that actually yielded a timestamp?! Best regards Uwe refclock.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/refclock.c b/refclock.c index a95f7fd59902..95d3abad4791 100644 --- a/refclock.c +++ b/refclock.c @@ -79,6 +79,7 @@ struct RCL_Instance_Record { int driver_poll; int driver_polled; int poll; + int inpoll; int leap_status; int pps_forced; int pps_rate; @@ -191,6 +192,7 @@ RCL_AddRefclock(RefclockParameters *params) inst->driver_parameter_length = 0; inst->driver_poll = params->driver_poll; inst->poll = params->poll; + inst->inpoll = 0; inst->driver_polled = 0; inst->leap_status = LEAP_Normal; inst->pps_forced = params->pps_forced; @@ -485,7 +487,7 @@ RCL_AddSample(RCL_Instance instance, struct timespec *sample_time, double offset log_sample(instance, &cooked_time, 0, 0, offset, offset - correction + instance->offset, dispersion); /* for logging purposes */ - if (!instance->driver->poll) + if (!instance->inpoll) instance->driver_polled++; return 1; @@ -631,7 +633,7 @@ RCL_AddCookedPulse(RCL_Instance instance, struct timespec *cooked_time, offset, dispersion); /* for logging purposes */ - if (!instance->driver->poll) + if (!instance->inpoll) instance->driver_polled++; return 1; @@ -710,9 +712,13 @@ poll_timeout(void *arg) poll = inst->poll; if (inst->driver->poll) { + int ret; poll = inst->driver_poll; - inst->driver->poll(inst); - inst->driver_polled++; + inst->inpoll = 1; + ret = inst->driver->poll(inst); + inst->inpoll = 0; + if (ret) + inst->driver_polled++; } if (!(inst->driver->poll && inst->driver_polled < (1 << (inst->poll - inst->driver_poll)))) { -- 2.30.2 -- To unsubscribe email chrony-dev-requ...@chrony.tuxfamily.org with "unsubscribe" in the subject. For help email chrony-dev-requ...@chrony.tuxfamily.org with "help" in the subject. Trouble? Email listmas...@chrony.tuxfamily.org.