|
|
Subscribe / Log in / New account

Leaping seconds and looping servers

Leaping seconds and looping servers

Posted Jul 3, 2012 11:07 UTC (Tue) by kunitz (subscriber, #3965)
In reply to: Leaping seconds and looping servers by josh
Parent article: Leaping seconds and looping servers

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.


to post comments

Leaping seconds and looping servers

Posted Jul 3, 2012 22:07 UTC (Tue) by simlo (guest, #10866) [Link] (2 responses)

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 (guest, #74652) [Link] (1 responses)

This is what I use for any relative time:

#ifndef CLOCK_MONOTONIC_RAW
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif

Leaping seconds and looping servers

Posted Jul 4, 2012 13:57 UTC (Wed) by simlo (guest, #10866) [Link]

Use of CLOCK_MONOTONIC is not an option because we might want to compare timestampt between different servers.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds