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