module Cf_tai64n:sig
..end
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:
Unix.gettimeofday
function.
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 details.
type
t
val compare : t -> t -> int
Cf_tai64n
module has the
signature of the Cf_ordered.Total_T
module type. compare a b
compares
two TAI64N values and returns either -1
, 0
, or 1
depending on the
relative total ordering of the values.val now : unit -> t
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.)val first : t
00000000 00000000 00000000
.val last : t
7fffffff ffffffff 3b9ac9ff
.val compose : Cf_tai64.t -> int -> t
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 greater than 1012.val decompose : t -> Cf_tai64.t * int
decompose x
to separate the TAI64N value x
into a TAI64 value and
an offset in nanoseconds.val to_unix_time : t -> float
Unix.gettimeofday
function.val of_unix_time : float -> t
Unix.gettimeofday
function into a TAI64N value.val to_label : t -> string
val of_label : string -> t
Cf_tai64.Label_error
if the label is not a valid
TAI64N label.val add : t -> float -> t
Cf_tai64.Range_error
if the result
is not a valid TAI64N value.val sub : t -> t -> float
sub t0 t1
returns the number of
seconds before t0
that t1
denotes.