Subject: | N_Delta_YMDHMS returns non-normalized value |
Date: | Sat, 14 Jan 2012 21:56:44 +0100 |
To: | bug-Date-Calc [...] rt.cpan.org |
From: | -- <klezli.istvan [...] gmail.com> |
Dear Author, dear Cpan,
I observed that _*N_Delta_YMDHMS*_subroutine returns non-normalized,
strange value. See the short code below. I wanted to calculate how old
my son is on a given date. In the second case (2012-01-06) the returned
parameter for days is 60!
Module version is *Date-Calc*, Gregorian calendar date calculations,
*Version: 6.3*, Released: 2009-10-31
I use this Perl version
This is perl, v5.10.0 built for MSWin32-x86-multi-thread
(with 9 registered patches, see perl -V for more detail)
Binary build 1005 [290470] provided by ActiveState
http://www.ActiveState.com
Built May 24 2009 12:17:36
My OS is: Windows XP SP3
Waiting for your answer.
Best Regards
Istvan from Hungary
----------------------
# source code to reproduce the problem
#!perl
use Date::Calc qw(N_Delta_YMDHMS);
($ye, $mo, $da, $ho, $mi, $se) = N_Delta_YMDHMS(2011, 04, 06, 22, 00,
00, 2012, 01, 05, 23, 59, 59);
print ">>> year: $ye, month: $mo, day: $da, hour: $ho, min: $mi, sec:
$se\n";
# >>> year: 0, month: 8, day: 30, hour: 1, min: 59, sec: 59
($ye, $mo, $da, $ho, $mi, $se) = N_Delta_YMDHMS(2011, 04, 06, 22, 00,
00, 2012, 01, 06, 0, 0, 0);
print ">>> year: $ye, month: $mo, day: $da, hour: $ho, min: $mi, sec:
$se\n";
# >>> year: 0, month: 7, day: 60, hour: 2, min: 0, sec: 0