chiark / gitweb /
debian/rules: Use `git' potty wrapper.
[qmail] / datetime.3
CommitLineData
2117e02e
MW
1.TH datetime 3
2.SH NAME
3datetime \- convert between TAI labels and seconds
4.SH SYNTAX
5.B #include <datetime.h>
6
7void \fBdatetime_tai\fP(&\fIdt\fR,\fIt\fR);
8
9datetime_sec \fBdatetime_untai\fP(&\fIdt\fR);
10
11struct datetime \fIdt\fR;
12.br
13datetime_sec \fIt\fR;
14.SH DESCRIPTION
15International Atomic Time, TAI,
16is the fundamental unit for time measurements.
17TAI has one label for every second of real time,
18without complications such as leap seconds.
19
20A
21struct datetime
22variable,
23such as
24.IR dt ,
25stores a TAI label.
26.I dt\fB.year
27is the year number minus 1900;
28.I dt\fB.mon
29is the month number, from 0 (January) through 11 (December);
30.I dt\fB.mday
31is the day of the month, from 1 through 31;
32.I dt\fB.hour
33is the hour, from 0 through 23;
34.I dt\fB.min
35is the minute, from 0 through 59;
36.I dt\fB.sec
37is the second, from 0 through 59;
38.I dt\fB.wday
39is the day of the week, from 0 (Sunday) through 6 (Saturday);
40.I dt\fB.yday
41is the day of the year, from 0 through 365.
42
43The
44.B datetime
45library supports more convenient TAI manipulation with
46the datetime_sec type.
47A datetime_sec value, such as
48.IR t ,
49is an integer referring to the
50.IR t th
51second after the beginning of 1970 TAI.
52The first second of 1970 TAI was 0;
53the next second was 1;
54the last second of 1969 TAI was -1.
55The difference between two datetime_sec values is a number
56of real-time seconds.
57
58.B datetime_tai
59converts a datetime_sec to a TAI label.
60
61.B datetime_untai
62reads a TAI label
63(specifically
64.IR dt\fB.year ,
65.IR dt\fB.mon ,
66.IR dt\fB.mday ,
67.IR dt\fB.hour ,
68.IR dt\fB.min ,
69and
70.IR dt\fB.sec )
71and returns a datetime_sec.
72.SH "SEE ALSO"
73now(3)