require Win32::Clock; $partial = Win32::Clock::get(); $integer = time; $string = localtime($integer);
print "Current time: Integer: $integer partial: $partial string : $string\n";
Win32::Clock::set(time() + 2*3600); # add 2 hours
@tz = Win32::Clock::TZ() or die "Windows error:".Win32::GetLastError;
print "We are in the ".(("Standard", "Daylight Savings")[$tz[0]]). " time range
Bias: $tz[1] StandardName: $tz[2]->[0] StandardDate: $tz[2]->[1] StandardDate-raw: ${\ join '-', @{$tz[2]->[2]}} StandardBias: $tz[2]->[3] DaylightName: $tz[3]->[0] DaylightDate: $tz[3]->[1] DaylightDate-raw: ${\ join '-', @{$tz[3]->[2]}} DaylightBias: $tz[3]->[3]\n";
print Win32::Clock::Unicode2ANSI("a\0s\0d\0f\0g\0\0\0");
The current version of Win32::Clock is available at:
http://www.dux.ru/guest/fno/perl/
Win32::GetLastError() and Win32::FormatMessage().
time().
<mi@linux.mediaprofil.ch>, thanks Milivoj!
($ISDST, $Bias, $StandardDate, $DaylightDate) = Win32::Clock::TZ() or die Win32::FormatMessage(Win32::GetLastError);
$ISDST - if 0 the operating system is operating in the range covered by the $StandardDate, if 1 - $DaylightDate
$Bias - the current bias, in minutes, for local time translation on this computer. The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time are based on the following formula: UTC = local time + bias
$StandardDate - refers to an array [$StdName, $StdString, $StdRaw, $StdBias]
$StdName - a string associated with standard time on this OS. For example, this parameter could contain "EST" to indicate Eastern Standard Time. This string can be empty.
$StdString - a string that indicates a date and UTC when the transition from daylight time to standard time occurs on this OS. This string can be the actual date or a friendly string like "last Sunday of September at 2:00", which means - every year. In the last case the Year element of the @$StdRaw array is 0.
$StdRaw - refers to an 8-elements array that contains raw date: [Year, Month, DayOfWeek, Day, Hour, Minute, Second, Milliseconds] - a date when the transition from daylight time to standard time occurs.
$StdBias - a bias value to be used during local time translations that occur during standard time. This value is added to the value of the $Bias to form the bias used during standard time. In most time zones, the value of this member is zero.
$DaylightDate - refers to an array [$DayName, $DayString, $DayRaw, $DayBias]
Almost the same as the corresponding values of @$StandardDate array but describe a date when the transition from standard time to daylight time occurs.
The supporting function
The correctness and even any similarity of the 2nd part of the code page is not guaranteed.
This module requires:
Win32::API module by Aldo Calpini.
June 9, 1999.
http://www.dux.ru/guest/fno/perl/
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.