On Wed, Oct 11, 2017 at 10:55 AM, Miroslav Lichvar <mlich...@redhat.com> wrote: > > On Tue, Oct 10, 2017 at 01:23:21PM -0400, Chris Perl wrote: > > + if (instance->tai) { > > + tai_offset = REF_GetTaiOffset(sample_time); > > It turned out, this doesn't actually handle the case I mentioned > before. We want to get the offset for the reference time, not the > local system time. For instance, if chronyd was started with local > clock in year 2000, it should apply the current TAI-UTC offset and not > the one from 2000. It seems this requires two separate calls of > REF_GetTaiOffset(). One to get an approximate reference time in UTC > and then get the actual TAI-UTC offset. > > I'll apply your patches with some minor modifications and add the > improved conversion in a separate commit. > > Thanks!
Ah. Thanks. > > + if (!tai_offset) { > > + DEBUG_LOG("refclock sample ignored unknown TAI offset"); > > + return 0; > > + } > > + > > + /* REF_GetTaiOffset returns the number of leap seconds that have > > + been inserted into UTC. To get from TAI to UTC, we have to > > + remove those seconds from the sample */ > > Strictly speaking, the offset between TAI and UTC is not the number of > leap seconds that have been applied so far. The offset already started > at 10. I'll just remove the comment. Right, sorry. I was trying to come up with a decent comment for why we were subtracting rather than adding. If you think its unnecessary, that is fine by me. -- 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.