Re: [chrony-dev] Fw: leap seconds correction |
[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]
On Wed, 12 Feb 2014 11:09:43 +0100 Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote: > On Wed, Feb 12, 2014 at 02:14:06AM +0100, Marek Behun wrote: > > > > http://www.ucolick.org/~sla/leapsecs/right+gps.html > > The last two paragraphs on that page imply that chrony smears the leap > second, that's not true. Similarly to ntpd, it just tells the kernel > to insert/delete the leap second and the Linux kernel does it by > stepping the clock back/forward by one second at midnight. > > > I was thinking about how to do this the best way and I have decided > > to write a compatibility library (which will override time > > getting/setting system calls with LD_PRELOAD), so the code of > > ntp/chrony or any other software that needs to think system clock is > > represented in classic POSIX timestamp doesn't need to be changed. > > You can find it at https://github.com/elkablo/time2posix . > > That's pretty cool. > > Did you test how it works during leap second? I suspect the ambiguity > in the UTC->right conversion when leap second is inserted could cause > some troubles. In linuxptp (PTP uses TAI) the problem is avoided by > suspending the operation during that second. I think chronyd and ntpd > would need to do that too. > > Also, you might need to intercept recv() and similar to adjust the > timestamps in the SO_TIMESTAMP and SO_TIMESTAMPING control messages. > I tried to simulate a leap second with little success - I tried running ntpd and changing kernel's adjtimex() status to STA_INS, but it didn't do anything observable. Can chrony simulate a leap second from a local leap second table file? Currently my code deletes STA_INS and STA_DEL bits in adjtimex() status when setting time status and sets STA_INS/STA_DEL bits (and return value of adjtimex() - TIME_INS, TIME_DEL, TIME_OOPS or TIME_WAIT) depending on the system time and leap seconds table. Thank you about the SO_TIMESTAMP/ING control messages, I didn't know about them. Till now I have only intercepted time setting functions and utmp/utmpx functions. File system API functions like utime, stat and others will also need to be intercepted. Marek
Attachment:
signature.asc
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |