[LEAPSECS] POSIX Time (was WP7A)

Zefram zefram at fysh.org
Sat Oct 10 19:22:16 EDT 2009


Joe Gwinn wrote:

>If you read the POSIX standard, you will find that the length of the day

>is defined as exactly 86,400 seconds, no more no less.


Not quite. To be precise, the time_t value increases by exactly 86400
per day, *regardless of how long the day is*. A POSIX time_t value is a
(lossy) transformation of a broken-down UTC time, *not* a linear count
of seconds.


>Another common source of confusion is that the POSIX Epoch is an instant

>defined in UTC terms,


... and occurring at a time for which the present form of UTC is
undefined. I don't think anyone actually attempts to apply the POSIX
time_t definition to pre-1972 (pre-leap-seconds) UTC. De facto, Unix
timestamps of any significant age cannot be precisely related to UTC
(or TAI or any other precision time scale). Historical time_t values
can at best only be interpreted as a transformation of vague UT, unusable
for sub-second absolute timing. (Actually, you won't often see pre-1990
timestamps that are accurate to the minute, let alone precise enough to
distinguish between flavours of UT.)


>> A user wishing to display correct UTC time during leap-second would

>> need to querry the NTP kernel

>

>A tall order for sure,


The ntp_adjtime() interface is semi-standard for Unix systems.
Interpreting all the variations of the interface is a bit of a task.
In the future the OS variants in how to do this should all be hidden by
uniform higher-level interfaces. That's the intent of my Perl module
Time::UTC::Now, <http://search.cpan.org/perldoc?Time::UTC::Now>.

-zefram


More information about the LEAPSECS mailing list