Re: [chrony-dev] [PATCH 2/3] refclock: Include TAI offset when adding samples

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Mon, Oct 09, 2017 at 11:34:05AM +0200, Miroslav Lichvar wrote:
> On Fri, Oct 06, 2017 at 03:09:02PM -0400, Chris Perl wrote:
> > @@ -76,6 +76,7 @@ struct RCL_Instance_Record {
> >    int poll;
> >    int leap_status;
> >    int pps_forced;
> > +  int tai;
> >    int pps_rate;
> >    int pps_active;
> >    int max_lock_age;
> 
> Please move the tai field after the new stratum field.
> 
> > @@ -189,6 +190,12 @@ RCL_AddRefclock(RefclockParameters *params)
> >      return 0;
> >    }
> >  
> > +  if (params->tai && !CNF_GetLeapSecTimezone()) {
> > +    LOG(LOGS_WARN,
> > +       "Refclock %s configured for auto tai offset, but no leapsectz configured",
> > +       UTI_RefidToString(params->ref_id));
> > +  }
> > +
> 
> I think this might be upgraded to a fatal error "refclock tai option
> requires leapsectz" (shorter messages save space).
> 
> > @@ -385,10 +394,25 @@ RCL_AddSample(RCL_Instance instance, struct timespec *sample_time, double offset
> >        return 0;
> >    }
> >  
> > -  filter_add_sample(&instance->filter, &cooked_time, offset - correction + instance->offset, dispersion);
> > +  if (instance->tai) {
> > +    tai_offset = REF_GetTaiOffset();
> > +  } else {
> > +    tai_offset = 0;
> > +  }
> 
> I'd suggest to simplify this whole hunk to something like:
>   if (instance->tai)
>     offset += REF_GetTaiOffset(...)

On second thought, it would better to not accumulate samples when the
TAI offset is unknown, so something like this:

    if (instance->tai) {
      tai_offset = REF_GetTaiOffset(sample_time);
      if (!tai_offset) {
	DEBUG_LOG("refclock sample ignored unknown TAI offset");
	return 0;
      }

      offset += tai_offset;
    }

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/