Name

tai — manipulate times with 1-second precision

Synopsis

#include <tai.h>

double \fBtai_approx\fP(&\fIt\fR);

int \fBtai_less\fP(&\fIa\fR,&\fIb\fR);

void \fBtai_add\fP(&\fIt\fR,&\fIa\fR,&\fIb\fR);

void \fBtai_sub\fP(&\fIt\fR,&\fIa\fR,&\fIb\fR);

struct tai \fIt\fR;

struct tai \fIa\fR;

struct tai \fIb\fR;

Description

A struct tai stores an integer between 0 inclusive and 2^64 exclusive. The format of struct tai is designed to speed up common operations; applications should not look inside struct tai\fR. A struct tai variable is commonly used to store a TAI64 label. Each TAI64 label refers to one second of real time. TAI64 labels span a period of hundreds of billions of years. See http://pobox.com/~djb/proto/tai64.txt for more information. A struct tai variable may also be used to store the numerical difference between two TAI64 labels.

Arithmetic

tai_approx returns a double-precision approximation to t. The result of tai_approx is always nonnegative. tai_less returns 1 if a is smaller than b, 0 otherwise. tai_add adds a and b modulo 2^64 and puts the result into t. The inputs and outputs may overlap. tai_sub subtracts b from a modulo 2^64 and puts the result into t. The inputs and outputs may overlap.

See also

tai_now(3)
tai_pack(3)
taia(3)
utc(3)

Author

Original code and documentation by Daniel J. Bernstein. Converted to DocBook XML by Jonathan de Boyne Pollard.