Skip Menu |

This queue is for tickets about the Calendar-Any CPAN distribution.

Report information
The Basics
Id: 77671
Status: new
Priority: 0/
Queue: Calendar-Any

People
Owner: Nobody in particular
Requestors: llg [...] cpan.org
Cc:
AdminCc:

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



Subject: Calendar::Any::Util::Solar::_current_timezone subtle error
_current_timezone() intends to calculate the offset of the local (non-DST) timezone from UTC/GMT in minutes. I was running into an off-by-one error with the Calendar::Any::Util::Solar test for next_longitude_date(), and I suspect it's because of the way _current_timezone() was implemented. (I am in the 'America/Los_Angeles' time zone going by the Unix time zone database, and we are in the middle of DST right now.) I will attach a patch for my changes to _current_timezone(); I think it makes the function work more the way it was intended, and in any case it corrects the test error for me. -LG
Subject: [PATCH] Calendar::Any::Util::Solar::_current_timezone subtle error
Subject: Solar.pm.diff
--- lib/Calendar/Any/Util/Solar.pm.orig 2012-06-06 09:39:37.000000000 -0700 +++ lib/Calendar/Any/Util/Solar.pm 2012-06-06 09:43:28.000000000 -0700 @@ -172,8 +172,11 @@ sub _current_timezone { my @gmtime = gmtime(0); my @localtime = localtime(0); - my $mins = 60*$localtime[2] + $localtime[1]; - return ( $localtime[5] == 70 ) ? $mins : $mins - 24*60; + my $mins = (60*$gmtime[2] + $gmtime[1] ) + - (60*($localtime[2]+$localtime[8]) + $localtime[1] ); + while ($mins < -14*60) { $mins += 24*60 } + while ($mins > 14*60) { $mins -= 24*60 } + return $mins; } 1;