3 THIS IS A SUBSET OF THE FULL LIBTAI. CHANGES HAVE BEEN MADE TO SUIT
4 LIBKUMU STYLE AND TYPE CONVENTIONS. ALL BUGS BELONG TO JOHN HURST.
5 THE FOLLOWING IS FOR ATTRIBUTION, THANK YOU MR. BERNSTEIN FOR WRITING
6 AND DISTRIBUTING SUCH GREAT SOFTWARE:
11 D. J. Bernstein, djb@pobox.com
12 http://pobox.com/~djb/libtai.html
15 libtai is a library for storing and manipulating dates and times.
17 libtai supports two time scales: (1) TAI64, covering a few hundred
18 billion years with 1-second precision; (2) TAI64NA, covering the same
19 period with 1-attosecond precision. Both scales are defined in terms of
20 TAI, the current international real time standard.
22 libtai provides an internal format for TAI64, struct tai, designed for
23 fast time manipulations. The tai_pack() and tai_unpack() routines
24 convert between struct tai and a portable 8-byte TAI64 storage format.
25 libtai provides similar internal and external formats for TAI64NA.
27 libtai provides struct caldate to store dates in year-month-day form. It
28 can convert struct caldate, under the Gregorian calendar, to a modified
29 Julian day number for easy date arithmetic.
31 libtai provides struct caltime to store calendar dates and times along
32 with UTC offsets. It can convert from struct tai to struct caltime in
33 UTC, accounting for leap seconds, for accurate date and time display. It
34 can also convert back from struct caltime to struct tai for user input.
35 Its overall UTC-to-TAI conversion speed is 100x better than the usual
36 UNIX mktime() implementation.
38 This version of libtai requires a UNIX system with gettimeofday(). It
39 will be easy to port to other operating systems with compilers
40 supporting 64-bit arithmetic.
42 The libtai source code is in the public domain.
48 \brief portable time functions
54 #include <KM_platform.h>
67 inline void add_seconds(i32_t s) { x += s; }
68 inline void add_minutes(i32_t m) { x += m * 60; }
69 inline void add_hours(i32_t h) { x += h * 3600; }
70 inline void add_days(i32_t d) { x += d * 86400; }
73 const tai& operator=(const caltime& rhs);
94 const caltime& operator=(const tai& rhs);
103 #endif // _KUMU_TAI_H_