module Cf_tai64:sig
..end
This module 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 second.
Functions are provided that:
Unix.time
function.
Warning: This implementation obtains the current time of day using the
POSIX time()
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
exception Range_error
exception Label_error
val compare : t -> t -> int
Cf_tai64
module has the
signature of the Cf_ordered.Total_T
module type. compare a b
compares
two TAI64 values and returns either -1
, 0
, or 1
depending on the
relative total ordering of the values.val now : unit -> t
time()
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
0000000000000000
.val last : t
7fffffffffffffff
.val to_unix_time : t -> float
Unix.gettimeofday
function.val of_unix_time : float -> t
Unix.time
function into a TAI64 value.val to_label : t -> string
val of_label : string -> t
Label_error
if the label is not a valid TAI64 label.val add : t -> int -> t
Range_error
if the result is not
a valid TAI64 value.val add_int32 : t -> int32 -> t
Range_error
if the result is not
a valid TAI64 value.val add_int64 : t -> int64 -> t
Range_error
if the result is not
a valid TAI64 value.val sub : t -> t -> int64
sub t0 t1
returns the number of
seconds before t0
that t1
denotes.