develooper Front page | perl.datetime | Postings from May 2003

Re: [cpan #2601] Bug in epoch() method

Thread Previous | Thread Next
Rick Measham
May 19, 2003 00:23
Re: [cpan #2601] Bug in epoch() method
Message ID:
> Return value from epoch() method is incorrect for many+varied years due to
> Time::Local's year parsing. Try converting the MacOS epoch from a DateTime
> object to an epoch time and back again, for example.

Maybe I don't quite get this. Here's my test code:

use DateTime;
print "Mac Epoch: " . time() . "\n";

print "DT Epoch:" . $dt->epoch() . "\n";

$dt2 = DateTime->from_epoch(epoch => $dt->epoch());
print "D2T Epoch:" . $dt2->epoch() . "\n";

Which prints:
Mac Epoch: 3136209605
DT Epoch:3136209605
D2T Epoch:3136209605

As would be expected. Have I missed the point here? Even if I
$dt->set(year=>1974) I get the right responses.


I wish he'd at least left his email address :)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About