Skip Menu |

This queue is for tickets about the Class-Date CPAN distribution.

Report information
The Basics
Id: 65358
Status: resolved
Priority: 0/
Queue: Class-Date

People
Owner: dlux [...] dlux.hu
Requestors: leo.griffiths [...] npc.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Daylight Savings possible error.
Date: Wed, 2 Feb 2011 11:36:29 +1100
To: bug-Class-Date [...] rt.cpan.org
From: Leo Griffiths <leo.griffiths [...] npc.com.au>
Module = Class::Date (DLUX/Class-Date-1.1.10.tar.gz) perl, v5.8.8 Linux 2.6.9-42.0.3.EL #1 Mon Sep 25 17:14:08 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux Hi, I think I have found an issue with the handling of the timezones when dealing with daylight savings time (DST). $Class::Date::DST_ADJUST=1; $date1 = date [2010,10,3, 1,0, 0], 'Australia/Sydney'; for (1..20) { $date1 += '15m'; foreach $date ( $date1 ){ print join(' , ', $date->string, $date->tz, $date->tzoffset, $date->isdst ); print "\n"; } } So the date I have used above is the date when daylight savings comes one and the time it switches is at 2am in the morning ( 2am becomes 3am ). Now if you run the code above you will see that it will increment the time however when it hits 2am it actually goes back to 1am again. I noticed this issue as it was causing an endless loop in my code. As an aside it seems to me that when DST_ADJUST is set true then the time should be adjusted to be in DST however this behaviour occurs when DST_ADJUST is false. Its is probably just the way I am thinking about it so not very important more just a thought. Thank you for writing this module it is really quite useful and I expect to use it much more in the future. Cheers
Hi, Thanks for the report. I see your point, it is indeed a bug. I have to investigate how to fix it in a way that I don't break other things. Thanks for the sample code, I'll use it as a test. Balázs
Hi Leo, I've looked at the problem, and the problem is that "2010-10-03 02:00:00" does not exist in "Australia/Sydney" timezone. If you don't care about the timezones, then you should use GMT. If you care about them, then $DST_ADJUST should be turned off. Both solves the problem. I pushed a new version of the POD file which tries to clear this up: http://code.google.com/p/perl-class-date/source/diff? spec=svnd1d4a7944cafeb81931d24aded63e64cd8b6bd9f&r=d1d4a7944cafeb81931d24ade d63e64cd8b6bd9f&format=side&path=/Date.pod Please let me know if it helped. Balázs
From: leo.griffiths [...] npc.com.au
On Sun Feb 06 10:37:14 2011, DLUX wrote: Show quoted text
> Hi Leo, > > I've looked at the problem, and the problem is that "2010-10-03 > 02:00:00" does not exist in > "Australia/Sydney" timezone. If you don't care about the timezones, > then you should use > GMT. If you care about them, then $DST_ADJUST should be turned off. > Both solves the > problem. > > I pushed a new version of the POD file which tries to clear this up: > > http://code.google.com/p/perl-class-date/source/diff? >
spec=svnd1d4a7944cafeb81931d24aded63e64cd8b6bd9f&r=d1d4a7944cafeb81931d24ade Show quoted text
> d63e64cd8b6bd9f&format=side&path=/Date.pod > > Please let me know if it helped. > > Balázs
Cheers, Balazs! Thanks for the quick response. I had already figured out the solution but felt the loop was an issue worth reporting. Thank you for the help. Leo