Hey DateTime guys,
calculating the time span between two events, one of which is before a daylight
saving time switch, and the other one is right after, DateTime shouldn't count
the non-existing time, right?
But if when calculating the elapsed time between 01:58 and 03:01
on 04/06/2003 (when the DST switch happened at 02:00 local time
in the US, forwarding the clock to 03:00), I would expect a 3
minute duration:
my $start = DateTime->new( year => 2003,
month => 4,
day => 6,
hour => 1,
minute => 58,
time_zone => "America/Chicago",
);
my $finish = DateTime->new( year => 2003,
month => 4,
day => 6,
hour => 3,
minute => 01,
time_zone => "America/Chicago",
);
my $duration = $finish - $start;
printf "%02d:%02d\n", $duration->hours(),
$duration->minutes(), "\n";
Instead, the above code prints "01:03", just like if didn't consider
the DST switch. On the other, hand it's well aware of the fact that times
between 02:00 and 03:00 are invalid, it rightfully refuses to construct
DateTime objects for these times. So why is the duration different?
-- Mike
Mike Schilli
[EMAIL PROTECTED]