Revision of ISO C 9x <time.h>

D. J. Bernstein djb at cr.yp.to
Thu Sep 3 17:42:12 UTC 1998


For a variety of reasons I've been building my own date-time library,
supporting five basic data types:

   * Calendar dates. ``struct caldate'' contains year, month, day. You
     can convert to and from YYYY-MM-DD strings for data interchange.

   * Day numbers. You can convert between calendar dates and MJD. This
     makes date arithmetic very easy for calendar programs.

   * Civil times. ``struct caltime'' contains date, hour, minute,
     second, and time-zone offset in minutes. You can convert to and
     from YYYY-MM-DD HH:MM:SS +OOOO strings for data interchange.

   * 1-second timestamps. ``struct tai'' stores a 64-bit real-time
     counter with a range of hundreds of billions of years. You can
     convert timestamps to and from a portable 8-byte format, defined in
     http://pobox.com/~djb/proto/tai64.txt, for storage or interchange.

   * 1-attosecond timestamps. ``struct taia'' stores a real-time
     counter, a nanosecond counter, and an attosecond counter. You can
     convert timestamps to and from a portable 16-byte format.

See http://pobox.com/~djb/libtai.html for the latest version.

---Dan



More information about the tz mailing list