Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-TimeZone CPAN distribution.

Report information
The Basics
Id: 35733
Status: resolved
Priority: 0/
Queue: DateTime-TimeZone

People
Owner: Nobody in particular
Requestors: david.pinkowitz [...] numarasoftware.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.75
Fixed in: 0.79



Subject: Cannot determine local time zone in Vista and Windows 2008 Server
The registry value StandardName no longer shows the correct time zone in Vista and Windows 2008 Server. Instead, the correct time zone is shown in a new value called TimeZoneKeyName, which does not exist in previous Windows versions. I've made a patch that appears to fix the problem. I was able to test this on Windows 2008 Server. I was not able to test this on a Vista machine at this point, although I've read that the keys are the same. I should note that at least on Windows 2008 Server, additional information was stored in the new registry value after the null character, so I needed to add code to clean that up as well. Here is the patch: --- C:/Perl/site/lib/DateTime/TimeZone/Local/Win32.pm +++ C:/Perl/site/lib/DateTime/TimeZone/Local/Win32.pm @@ -5,10 +5,8 @@ use base 'DateTime::TimeZone::Local'; -my %Registry; use Win32::TieRegistry ( 'KEY_READ', Delimiter => q{/} ); - sub Methods { return qw( FromEnv FromRegistry ) } sub EnvVars { return 'TZ' } @@ -187,7 +185,12 @@ my $class = shift; my $keyObject = $Registry->Open( $Key, { Access => KEY_READ } ); - my $win_name = $keyObject->{'/StandardName'}; + my $win_name = $keyObject->{'/TimeZoneKeyName'} eq ''? + $keyObject->{'/StandardName'} : + $keyObject->{'/TimeZoneKeyName'}; + + # remove data from null character to end of value + $win_name =~ s/\0.*$//; return unless $win_name;
From: david.pinkowitz [...] numarasoftware.com
I've now tested this on Vista and it seems to work.