Closed dfc closed 13 years ago
This request is out of scope for this module. The purpose of chrono.js is to provide date formatting for JavaScript's Date objects. It doesn't do any date calculation of its own. In general, TAI64 seems pretty tough to implement in JavaScript, as JavaScript doesn't have native 64 bit integers. If you want to give it a shot anyway, I suggest starting a separate module.
The following description is stolen from: http://cr.yp.to/libtai/tai64.html
TAI64 labels and external TAI64 format
A TAI64 label is an integer between 0 and 2^64 referring to a particular second of real time. Integer s refers to
Integers 2^63 and larger are reserved for future extensions. Under many cosmological theories, the integers under 2^63 are adequate to cover the entire expected lifetime of the universe; in this case no extensions will be necessary.
A TAI64 label is normally stored or communicated in external TAI64 format, consisting of eight 8-bit bytes in big-endian format. This means that bytes b0 b1 b2 b3 b4 b5 b6 b7 represent the label b0 * 2^56
For example, bytes 3f ff ff ff ff ff ff ff hexadecimal represent the second that ended 1969 TAI; bytes 40 00 00 00 00 00 00 00 hexadecimal represent the second that began 1970 TAI; bytes 40 00 00 00 00 00 00 01 hexadecimal represent the following second. Bytes 40 00 00 00 2a 2b 2c 2d hexadecimal represent 1992-06-02 08:07:09 TAI, also known as 1992-06-02 08:06:43 UTC.
TAI64N labels and external TAI64N format
A TAI64N label refers to a particular nanosecond of real time. It has two parts:
A TAI64N label is normally stored or communicated in external TAI64N format, consisting of twelve 8-bit bytes. The first eight bytes are the TAI64 label in external TAI64 format. The last four bytes are the nanosecond counter in big-endian format.
TAI64NA labels and external TAI64NA format
A TAI64NA label refers to a particular attosecond of real time. It has two parts:
A TAI64NA label is normally stored or communicated in external TAI64NA format, consisting of sixteen 8-bit bytes. The first twelve bytes are the TAI64N label in external TAI64N format. The last four bytes are the attosecond counter in big-endian format.
Historical notes
Many network protocols and filesystems store timestamps in the original UNIX format: a signed 32-bit integer representing the number of seconds since the beginning of 1970. This format will expire in 2038. Other protocols store timestamps as unsigned 32-bit integers representing the number of seconds since 1900; this format will expire in 2036.
TAI64 was defined in July 1997 for use in new protocols. TAI64N and TAI64NA were defined at the same time for protocols where 1-second precision is insufficient.