
Time::TAI64 - Perl extension for converting TAI64 strings into standard unix timestamps.

Generate TAI64 timestamps
use Time::TAI64 qw/tai64n/; use Time::HiRes qw/time/; $now = time; # High precision printf "%s\n", unixtai64n($now);
Print out human readable logs
use Time::TAI64 qw/:tai64n/;
open FILE, "/var/log/multilog/stats";
while(my $line = <FILE>) {
my($tai,$log) = split(' ',$line,2);
printf "%s %s",tai64nlocal($tai),$log;
}
close FILE;

This is a package provides routines to convert TAI64 strings, like timestamps produced by multilog, into values that can be processed by other perl functions to display the timestamp in human-readable form and/or use in mathematical computations.

In order to use any of these functions, they must be properly imported by using any of the following tags to use related functions:
Generic Functions
This method converts a tai64, tai64n, or tai64na string into a unix timestamp. If successfull, this function returns an integer value containing the number of seconds since Jan 1, 1970 as would perl's time function. If an error occurs, the function returns a 0.
This method converts the tai64, tai64n, or tai64na string given as its first parameter and, returns a formatted string of the converted timestamp as formatted by its second parameter using strftime conventions.
If this second parameter is ommited, it defaults to "%a %b %d %H:%M:%S %Y" which should print the timestamp as: Mon Nov 1 12:00:00 2004
TAI64 Functions as well as Generic Functions
This method converts the tai64 string given as its only parameter and if successfull, returns a value for timestamp that is compatible with the value returned from time.
This method converts a unix timestamp into a TAI64 string.
TAI64N Functions as well as Generic Functions
This method converts the tai64n string given as its only parameter and if successfull, returns a value for timestamp that is compatible with the value returned from Time::HiRes::time.
This methods returns a tai64n string using the parameters supplied by the user making the following assumptions:
real number, the integer part is used for the seconds and the fractional part is converted to nanoseconds.This utility returns a string representing the tai64n timestamp converted to local time in ISO format: YYYY-MM-DD HH:MM:SS.SSSSSSSSS.
The reason to include this funtion is to provide compatibility with the command-line version included in daemontools.
TAI64NA Functions as well as Generic Functions
This method converts the tai64na string given as its only parameter and if successfull, returns a value for timestamp that is compatible with the value returned from Time::HiRes::time.
This method returns a tai64na string unsing the parameters supplied by the user making the following assumptions:
real number, the integer part is used for the seconds and the fractional part is converted to nanoseconds amd attoseconds.
http://pobox.com/~djb/libtai/tai64.html
http://cr.yp.to/daemontools.html

Jorge Valdes, <jorge@joval.info>

This module was started by AMS, but would not have been completed if Iain Truskett hadn't taken over. After his death, Jorge Valdes assumed ownership and rewrote it in Perl.

Copyright (C) 2004-2006 by Jorge Valdes
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

The lastest version of this library is likely to be available from CPAN.