Re: [chrony-users] Nanosecond precision with refclock SOCK

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


On Mon, Jan 15, 2024 at 8:15 PM Miroslav Lichvar <mlichvar@xxxxxxxxxx> 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


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