Re: Nanosecond precision with refclock SOCK

James Clark <[email protected]>
Newsgroups gmane.comp.time.chrony.user
Message-ID <CANz3_EYM6PcH5bY_OOkbBLkJPpus=B0YiXcpdsu4WXpiZ1CtEA@mail.gmail.com>
On Mon, Jan 15, 2024 at 8:15 PM Miroslav Lichvar <[email protected]>
wrote:

> On Mon, Jan 15, 2024 at 06:57:48PM +0700, James Clark wrote:
> > In computing the initial step, how does chrony handle leap seconds?
> >
> > There are two ways of computing offsets:
> > - subtracting the TAI times (so that it is really the number of seconds
> > that elapse between the system time and the true time)
> > - subtracting the POSIX times (so leap seconds are ignored)
>
> chronyd corrects the system clock, which ignores leap seconds, so it
> expects the second approach. It doesn't do any corrections of the
> offset.
>

This is going to be a bit strange in the vicinity of a positive leap
second. Suppose the true time is ahead of the system time by 3 seconds.
There are three successive cases around a positive leap second:

- the true time is before the start of the leap: in this case the
difference in the POSIX system times will be 3
- the true time is after the leap has finished but system time is before
the leap: in this case the difference in the POSIX times will be 2 (because
1 second of the difference is a leap second and so ignored)
- the system time is after the leap is finished: in this case the
difference will again be 3

Are you saying that chrony expects the offset to jump around like this
(even though there is no change in the amount by which the clock needs to
be corrected)?

I can change my code to implement this, if that's what's needed: I would
convert both times to POSIX before computing the offset, instead of
converting them both to TAI.

James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.