Re: [PATCH] libc/time: Add CLOCK_TAI
Corinna Vinschen via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Jul 16 11:18, Corinna Vinschen via Newlib wrote: > On Jul 15 15:01, brian.inglis--- via Newlib wrote: > > On 2025-07-15 02:43, Corinna Vinschen via Newlib wrote: > > > On Jul 14 14:38, Brian Inglis via Newlib wrote: > > > > On 2025-07-14 09:45, Corinna Vinschen via Newlib wrote: > > > > > On Jul 11 06:35, Sebastian Huber wrote: > > > > > > FreeBSD also provides this clock identifier, maybe it should be > > > > > > #if __BSD_VISIBLE > > > > > > #define CLOCK_TAI (11) > > > > > > #endif > > > > > > ? > > > > > > > > > Probably, but I seriously wonder how to implement CLOCK_TAI on Cygwin. > > > > > > > > > IIUC, if you don't do anything special, the CLOCK_REALTIME and CLOCK_TAI > > > > > return the same value, because the leap second is set to 0 at kernel > > > > > startup. Maybe that's enough... > > > > > > > > If you are running an NTP server you just have to ask for the system variable: > > > > [...] > > > What we could do is to define CLOCK_TAI as CLOCK_REALTIME + 37 in the DLL > > > for the time being, and the DLL could check if a file "/etc/leapsecs" > > > exists and read it to compensate for new leap secs. We can add such a > > > file to the distro when a new leap sec has been defined. > > > > It may be better to just use the standard approach and standard file name > > which is /etc/leap-seconds.list, often symlinked from /etc/ntp/ which may > > itself be symlinked from /var/lib/ntp/. > > Actually, yesterday I hacked some POC code in my local Cygwin sandbox > using the file /usr/share/zoneinfo/leapseconds from tzdata. If the file > isn't present, the DLL uses the current leap secs offset of 37 secs. > Seems to work nicely. > > So I'm looking forward to Sebastian adding the CLOCK_TAI macro to time.h. I pushed Sebastians patch at his request. Btw, Brian, the Fedora tzdata package contains not only the file /usr/share/zoneinfo/leapseconds, but additionally the original file /usr/share/zoneinfo/leap-seconds.list. Can you please add it to your Cygwin tzdata package as well? Thanks, Corinna