CC: | Andrew Ruthven <andrew [...] etc.gen.nz> |
Subject: | DateCalc always answers in units of hours |
Date: | Tue, 2 Aug 2016 22:59:47 +0200 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Göran Uddeborg <goeran [...] uddeborg.se> |
While looking at the mythtv-status tool, I found what I believe to be
a bug in Date-Manip. It is reproducible with the script below. When
I run it, it returns 0:0:0:0:49:2:3. That is, 49 hours, rather than
0:0:0:2:1:2:3, a.k.a. two days and one hour, as I would expect.
I don't know perl well at all, so there might be some subtlety here
I'm missing. But the mythtv-status author (cc:ed) seems to confirm my
suspicion, so I felt brave enough to venture this report. :-)
I've tried with both DM5, DM6, and without the initial block
completely, and all behave the same.
================ test script ================
#!/usr/bin/perl -w
{
no warnings 'once';
$Date::Manip::Backend = 'DM6';
}
use Date::Manip;
my $err;
my $diff;
$diff = DateCalc('2016-07-26T00:00:00', '2016-07-28T01:02:03', \$err, 0);
print $diff;