Legend:
Library
Module
Module type
Parameter
Class
Class type
Computations with the Temps Atomique International (TAI) timescale.
Overview
This module (and its cognate Cf_tai64) defines an abstract type and associated functions for computations with values representing epochs in the Temps Atomique International (TAI) timescale. Values are represented internally with the TAI64 format defined by Dan Bernstein, and support precision to the nearest nanosecond.
Functions are provided that:
acquire the current time in TAI64N format.
compare, add and subtract values.
convert between TAI64N values and a portable external format called the "TAI64N label", which is essentially an array of twelve octets.
convert between TAI64N values and the float values returned by the Unix.gettimeofday function.
Constants are also provided that define the boundaries of valid TAI64N representations.
Warning: This implementation obtains the current time of day using the POSIX gettimeofday() function, which returns a value based on the UTC timescale (but with leap seconds "elided" in a way that makes conversions between POSIX time, Standard Time and TAI a perilous undertaking). See the Cf_stdtime module for detail
Returns the current time in TAI64N, obtained by reading the current time from the POSIX gettimeofday() function, and adjusting for leap seconds. (Currently, the leap seconds table is hardcoded into the library, and the most recent leap second announcement was for Dec 31, 1998.)
Use compose s ns to compose a TAI64N value from a TAI64 value s and an offset of ns nanoseconds. Raises Invalid_argument if the number of nanoseconds is not less than 1012.
Interprets the argument as a TAI64N label and returns the corresponding TAI64N value. Raises Cf_tai64.Label_error if the label is not a valid TAI64N label.