I.m having some problems comparing dates using the Date::Ical module. For
some reason, I'm getting a negative duration result when I shouldn't.
Here's some sample code that illustrates my problem:
use Date::ICal;
$ical = Date::ICal->new(year => "2003", month => "03", day => "04", hour
=> "17",
min => "30", sec => "22");
$ical2 = Date::ICal->new(year => "2003", month => "03", day => "04", hour
=> "19",
min => "30", sec => "22");
$time = $ical2 - $ical;
$seconds = $time->as_seconds;
$icaltest = $ical->ical;
$ical2test = $ical2->ical;
print("$seconds\n");
print("$icaltest\n$ical2test\n");
When ran the output is:
-165600
20030304T233022Z
20030305T013022Z
But I would have expected that $seconds to equal 7200. When I change the
first hour to 12 and the second to 14, the output I get is 7200. Is there
something I'm missing here? Any help would be greatly appreciated.
Thanks,
Scott