DateTime::Format::Epoch::TAI64 - Convert DateTimes to/from TAI64 values
use DateTime::Format::Epoch::TAI64; my $formatter = DateTime::Format::Epoch::TAI64->new(); my $dt = $formatter->parse_datetime( '4611686019483526367' ); # 2003-06-20T19:49:59 $formatter->format_datetime($dt); # 4611686019483526367 my $str_frmt = DateTime::Format::Epoch::TAI64->new( format => 'string' ); $dt = $str_frmt->parse_datetime( "\x40\0\0\0\x3e\xf3\x69\x6a" ); # 2003-06-20T19:49:59 $str_frmt->format_datetime($dt); # "\x40\0\0\0\x3e\xf3\x69\x6a"
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to a TAI64 value. The TAI64 timescale covers the entire expected lifespan of the universe (at least, if you expect the universe to be closed).
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor.
new( [format => 'string'] )
Constructor of the formatter/parser object. If the optional format parameter is set to 'string', TAI64 values will be expected to be 8 byte strings.
Before the introduction of the leap seconds in 1972, the relation between TAI and UTC was irregular. In this module, it is assumed that the difference TAI-UTC was 9 seconds constantly. Any errors introduced by this assumption come from the irregularity of UTC, and are not TAI64's fault or mine.
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
Eugene van der Pijll <pijll@gmx.net>
Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DateTime
datetime@perl.org mailing list
http://cr.yp.to/time.html
To install DateTime::Format::Epoch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DateTime::Format::Epoch
CPAN shell
perl -MCPAN -e shell install DateTime::Format::Epoch
For more information on module installation, please visit the detailed CPAN module installation guide.