Iain Truskett (PAUSE Custodial Account)

NAME

Time::TAI64 - a library for storing and manipulating dates and times.

SYNOPSIS

    use Time::TAI64 qw( :caldate :caltime :tai :leapsecs :taia );
    use Time::TAI64 qw( :all );

DESCRIPTION

NOTE: THIS IS AN EXPERIMENTAL VERSION. THE USER INTERFACE WILL CHANGE AND IT WILL CHANGE DRASTICALLY. PLEASE WAIT UNTIL VERSION 1.9 BEFORE USING THIS MODULE.

ALSO, A LOT OF THE CODE WILL CHANGE. SO, DON'T RELY ON ANYTHING IN THIS MODULE BEING THE SAME IN TWO WEEKS. OH, AND THE DOCUMENTATION WILL BE DRASTICALLY IMPROVED.

THAT SAID, TEST FAILURES WOULD BE APPRECIATED =)

Time::TAI64 is a library for storing and manipulating dates and times.

Time::TAI64 supports two time scales:

  1. TAI64, covering a few hundred billion years with 1-second precision

  2. TAI64NA, covering the same period with 1-attosecond precision. Both scales are defined in terms of TAI, the current international real time standard.

Time::TAI64 provides an internal format for TAI64, TAIPtr, designed for fast time manipulations. The tai_pack() and tai_unpack() routines convert between struct tai and a portable 8-byte TAI64 storage format. Time::TAI64 provides similar internal and external formats for TAI64NA (TAIAPtr).

Time::TAI64 provides CaldatePtr to store dates in year-month-day form. It can convert CaldatePtr, under the Gregorian calendar, to a modified Julian day number for easy date arithmetic.

Time::TAI64 provides CaltimePtr to store calendar dates and times along with UTC offsets. It can convert from TAIPtr to CaltimePtr in UTC, accounting for leap seconds, for accurate date and time display. It can also convert back from CaltimePtr to TAIPtr for user input. Its overall UTC-to-TAI conversion speed is 100x better than the usual UNIX mktime() implementation.

This version of Time::TAI64 requires a UNIX system with gettimeofday(). It will be easy to port to other operating systems with compilers supporting 64-bit arithmetic.

OBJECT ORIENTED INTERFACE

The preferred way of using this library is through objects. You don't have to though since the complete complement of functions is available via various export groups. See the FUNCTIONS section for more detail.

XXX

FUNCTIONS

There's quite a few functions. 41 all up (unless I miscounted). This section is divided into the export groups.

I will warn you, up front, that your code will end up over long if you stick to using functions. Each data object produced by this module that is not a simple integer or string is an opaque object and you will need to use accessors to use its attributes. Thus, the OO interface is generally recommended.

:caldate

caldate_new
caldate_fmt
caldate_scan
caldate_mjd
caldate_frommjd
caldate_normalize
caldate_easter
caldate_day
caldate_month
caldate_year

:caltime

caltime_tai
caltime_utc
caltime_fmt
caltime_scan
caltime_offset
caltime_second
caltime_minute
caltime_hour
caltime_date

:tai

tai_now
tai_approx
tai_add
tai_sub
tai_less
tai_pack
tai_unpack

:leapsecs

leapsecs_init
leapsecs_read
leapsecs_add
leapsecs_sub

:taia

taia_tai
taia_now
taia_approx
taia_frac
taia_add
taia_sub
taia_half
taia_less
taia_pack
taia_unpack
taia_fmtfrac

AUTHOR

Iain Truskett <spoon@cpan.org> http://eh.org/~koschei/

Please report any bugs to http://rt.cpan.org/ or email them (and/or suggestions to me directly at <spoon@cpan.org>

COPYRIGHT

XS and Perl code copyright (c) 2002 Iain Truskett. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

C source files derived from qlogtools, copyright 2000 Bruce Guenter. Those derived from libtai are public domain. Those from daemontools are copyright 2001 D J Bernstein.

ACKNOWLEDGEMENTS

DJB for writing libtai and daemontools. Bruce Guenter for qlogtools.

SEE ALSO

See http://cr.yp.to/time.html, http://untroubled.org/qlogtools/