[PATCH] libc/time: Add CLOCK_TAI
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Jul 21 10:16:14 GMT 2025
On Jul 18 15:23, Brian Inglis wrote:
> On 2025-07-17 03:19, Corinna Vinschen wrote:
> > You can do that, but the file should be where it is on Fedora as well.
> > [...]
> > In our case it's inside the DLL. Right now the code uses
> > /usr/share/zoneinfo/leapseconds, see
> > https://sourceware.org/cgit/newlib-cygwin/commit/?id=2abb929f0ad2
> >
> > It's actually a bit of a bummer either way. Just to find out the
> > current leap second offset, we have to read a file of 80 lines
> > (leapseconds) or even 120 lines (leap-seconds.list).
>
> One disadvantage of tzdb zic leapseconds is you have to sum the +/- and add
> a fudge factor of 10 to get the TAI offset, whereas leap-seconds.list last
> data line gives the current offset 37 directly, if the NTP timestamp is in
> the past.
Same work either way. We have to read the file line by line until the end
to be sure that we catched all relevant lines.
> > There's a good chance we'll never have another leap second, given the latest
> > leap sec was 2017, and leap secs will be deprecated entirely in 2035.
>
> What scares people, if current DUT1 trends continue, we could need a
> *negative* leap second before then, ~7 years from now.
Doesn't scare us because we *only* care for clocks and timers, not for
the actual presentation of leap seconds in a struct tm. Only CLOCK_TAI
is affected as far as the DLL is concerned.
> > So I think the DLL should actually read and evaluate that registry key
> > in the first place. 37 secs, plus the entries in "LeapSeconds".
>
> Unlike leap-seconds.list, and like MS date/time/zone approximations, without
> the list of leap-seconds, accurate past time zone and TAI values are not
> available, whereas tzdata-right provides interesting values like:
> [...]
Somehow you're missing what's already implemented, it seems:
https://sourceware.org/cgit/newlib-cygwin/commit/?id=2abb929f0ad2
https://sourceware.org/cgit/newlib-cygwin/commit/?id=f0912e9a74cd
https://sourceware.org/cgit/newlib-cygwin/commit/?id=a0634931f181
Ultimately, it would still be nice if you would add
/usr/share/zoneinfo/leap-seconds.list to the tzdata package, just as
on Fedora, even if we don't use it from the DLL.
Corinna
More information about the Cygwin-developers
mailing list