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
Posted Jul 3, 2012 22:07 UTC (Tue)
by simlo (guest, #10866)
[Link] (2 responses)
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).
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.
Posted Jul 3, 2012 23:43 UTC (Tue)
by dashesy (guest, #74652)
[Link] (1 responses)
This is what I use for any relative time:
Posted Jul 4, 2012 13:57 UTC (Wed)
by simlo (guest, #10866)
[Link]
Leaping seconds and looping servers
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.
Right now we are using CLOCK_REALTIME and using arithmetic on the resulting struct timestamp to find time differences.
Leaping seconds and looping servers
#ifndef CLOCK_MONOTONIC_RAW
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif
Leaping seconds and looping servers
