DateTime::TimeZone::Local::Win32 - Determine the local system's time zone on Windows |
DateTime::TimeZone::Local::Win32 - Determine the local system's time zone on Windows
my $tz = DateTime::TimeZone->new( name => 'local' );
my $tz = DateTime::TimeZone::Local->TimeZone();
This module provides methods for determining the local time zone on a Windows platform.
This class tries the following methods of determining the local time zone:
It checks $ENV{TZ}
for a valid time zone name.
When using the registry, we look for the Windows time zone and use a mapping to translate this to an Olson time zone name.
We look in "SYSTEM/CurrentControlSet/Control/TimeZoneInformation/" for a node named "/TimeZoneKeyName". If this exists, we use this key to look up the Olson time zone name in our mapping.
We look in "SOFTWARE/Microsoft/Windows NT/CurrentVersion/Time Zones/" and loop through all of its sub keys.
For each sub key, we compare the value of the key with "/Std" appended to the end to the value of "SYSTEM/CurrentControlSet/Control/TimeZoneInformation/StandardName". This gives us the English name of the Windows time zone, which we use to look up the Olson time zone name.
The algorithm is the same as for NT, but we loop through the sub keys of "SOFTWARE/Microsoft/Windows/CurrentVersion/Time Zones/"
Dave Rolsky, <autarch@urth.org>
Copyright (c) 2003-2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
DateTime::TimeZone::Local::Win32 - Determine the local system's time zone on Windows |