> Using TAI internally has its own challenges, though, including a need to avoid changing the time representation as seen by user space—meaning that the kernel would still have to track leap seconds internally.
Is that actually true? Shouldn't we just be able to make libc deal with it?
Posted Jul 3, 2012 3:16 UTC (Tue) by corbet (editor, #1)
[Link]
If you were designing a system from the beginning, you could consider that kind of division of responsibilities. The kernel has to fit into existing systems, though, without breaking things. That means preserving the current interfaces.
Leaping seconds and looping servers
Posted Jul 3, 2012 6:47 UTC (Tue) by josh (subscriber, #17465)
[Link]
True, but the kernel has gone through transitions like this before. glibc could learn to track leap-seconds itself. The kernel could have a compile-time option to enable compatibility support for older userspace, defaulting to on for now. After a distro release or two, that option could go away.
Leaping seconds and looping servers
Posted Jul 3, 2012 11:07 UTC (Tue) by kunitz (subscriber, #3965)
[Link]
The kernel must know the POSIX time to update file systems time, because of the definitions of the file system formats. POSIX time requires you to manage UTC including leap seconds in the kernel, but having a linear progressing time as basic time source would definitely make sense.
Leaping seconds and looping servers
Posted Jul 3, 2012 22:07 UTC (Tue) by simlo (subscriber, #10866)
[Link]
Yes, if I would (if I had the time) do the following
Make a alias for the POSIX CLOCK_REALTIME -> CLOCK_UTC. Make a new CLOCK_TAI running along CLOCK_UTC. And some function to get the difference between CLOCK_TAC and CLOCK_UTC at any given time (except you don't know about future leap seconds).
Many POSIX API implicitly CLOCK_REALTIME=CLOCK_UTC. Alternativ APIs must be made where the user can choose between CLOCK_UTC, CLOCK_TAI, CLOCK_MONOTONIC etc. In many (most) cases CLOCK_MONOTONIC would make most sense.
In the applications I am working on right now, I would try to restrict myself to CLOCK_MONOTONIC and CLOCK_TAC, but I would need to translate to and from UTC because some protocols require timestamps in UTC.
Right now we are using CLOCK_REALTIME and using arithmetic on the resulting struct timestamp to find time differences.
Leaping seconds and looping servers
Posted Jul 3, 2012 23:43 UTC (Tue) by dashesy (subscriber, #74652)
[Link]