Subject: | DateTime::Format::Duration bug |
Date: | Fri, 10 Jul 2009 12:31:59 +1000 |
To: | bug-DateTime-Format-Duration [...] rt.cpan.org |
From: | Simon Cocking <simon [...] mailguard.com.au> |
$ perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
$ perl -MDateTime::Format::Duration -le 'print
$DateTime::Format::Duration::VERSION'
1.03
Taking the sample code from the CPAN documentation:
#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
use DateTime::Duration;
use DateTime::Format::Duration;
my $d = DateTime::Format::Duration->new(
pattern => '%Y years, %m months, %e days, '.
'%H hours, %M minutes, %S seconds'
);
print $d->format_duration(
DateTime::Duration->new(
years => 3,
months => 5,
days => 1,
hours => 6,
minutes => 15,
seconds => 45,
nanoseconds => 12000
)
);
Is supposed to output:
# 3 years, 5 months, 1 days, 6 hours, 15 minutes, 45 seconds
Actually outputs:
# 0 years, 41 months, 1 days, 00 hours, 375 minutes, 45 seconds
Simon Cocking
Director of Technology
MailGuard: Protection | Productivity | Profit
2006 | 2007 Deloitte Technology Fast 500 Winner - Asia Pacific
P: 1300 30 44 30
F: 03 9011 6110
W: www.mailguard.com.au
E: simon@mailguard.com.au
--
MailGuard | http://www.mailguard.com.au/about-us
Australian Owned and Locally Supported
Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au/mg