tai: International Atomic Time¶
TAI or Temps Atomique International (French for International Atomic Time), measures real time. One second of TAI time is a constant duration defined by cesium radiation. TAI has been measured continuously since 1955 and is the foundation of all civil time standards.
Data types¶
-
struct
tai
¶ Platform independent container for a TAI, time with second precision.
It holds a value between 0 inclusive and \(2^{64}\) exclusive. Applications are discouraged to look inside
struct tai
.
-
struct
taia
¶ Platform independent container for a TAIA, time with atto second precision.
It holds a value between 0 inclusive and \(2^{64}\) exclusive. The number is a multiple of \(10^{-18}\). Applicaitons are discouraged to look inside
struct taia
.
API¶
Note
It is assumed that the time()
function returns a time that
represents the number of TAI seconds since 1970-01-01 00:00:10 TAI.
-
void
tai_add
(struct tai *t, const struct tai *a, const struct tai *b)¶ Add two TAI and collect the results in
t
.
-
void
tai_sub
(struct tai *t, const struct tai *a, const struct tai *b)¶ Substract two TAI and collect the results in
t
.
-
int
tai_cmp
(const struct tai *a, const struct tai *b)¶ Compare two TAI, suitable for most sort functions.
-
void
tai_pack
(const struct tai *t, char *s)¶ Pack a TAI to string, suitable for disk storage or network usage.
Note
The gettimeofday()
function returns nano second precision (at best),
although struc taia
can hold atto second precision.
-
void
taia_add
(struct taia *ta, const struct taia *a, const struct taia *b)¶ Add two TAIA and collect the results in
t
.
-
void
taia_sub
(struct taia *ta, const struct taia *a, const struct taia *b)¶ Substract two TAIA and collect the results in
t
.
-
int
taia_cmp
(const struct taia *a, const struct taia *b)¶ Compare two TAIA, suitable for most sort functions.