Re: Unix Time and Leap Seconds



Rainer Weikusat <rweikusat@xxxxxxxxxxx> wrote:
William Ahern <william@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:
<snip>
time() makes no guarantees about monotonicity.

It is defined as

The time() function shall return the value of time in seconds
since the Epoch.

Which means it is clearly supposed to be monotonic.

What if the "Epoch" changes? time() describes the semantics of a single
call. CLOCK_MONOTONIC describes the relationship of the return values
amongst multiple calls. One _clearly_ dictates the desired behavior, the
other is arguable, and in practice it doesn't do what the OP wants for
technical reasons.

Also, couldn't a conforming implementation simply instantly jump forward or
backwards for a leap second? The Epoch is an astronomical metric, so even if
the second is defined by a relatively constant physical metric, the Epoch
isn't.
.



Relevant Pages

  • Re: time format +1 hour
    ... years where they add/subtract a leap second;-) ... The unix time_t value ignores leap seconds. ... The unix time_t counts seconds since the epoch. ... the fact is that all POSIX implementations implement the ...
    (comp.lang.perl.misc)
  • Re: timer in milliseconds [OT]
    ... If only POSIX were that simple ... ... 'Seconds since the Epoch', and that's where the fun starts. ... Epoch is defined as 1970-01-01 00:00:00 UTC. ... think of the Epoch moving each time a leap second is added or ...
    (comp.lang.c)