NAME

Win32::Clock - Win32 system clock


SYNOPSIS

    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"); 


ABSTRACT

This module provides methods to manipulate Win32 system clock with 0.01 s precision.

The current version of Win32::Clock is available at:

  http://www.dux.ru/guest/fno/perl/ 


DESCRIPTION

This module provides several non-exported subroutines. All subs return FALSE on errors and error info is available via Win32::GetLastError() and Win32::FormatMessage().

get ( )
Returns current time in partial form like Time::HiRes::time(). It has the same meaning as perl built-in function time().

set ( )
Requires one parameter in the same form as the result of get() (integer is also OK). Sets system clock to the new value.

TZ ( )
This subroutine derives from the script posted by Milivoj Ivkovic <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

Unicode2ANSI ( )
Takes a Unicode string and returns the same string converted to ANSI. Charachters that cannot be represented in ANSI code page are omitted.

The correctness and even any similarity of the 2nd part of the code page is not guaranteed.

There are some more functions in the package, but probably useless.


INSTALLATION

As this is just a plain module no special installation is needed. Put it into the Win32 subdirectory somewhere in your . @INC.

This module requires:

Win32::API module by Aldo Calpini.


CAVEATS

This module has been created and tested in a Win95 environment. Although версия для печати I expect it to function correctly on Windows NT, that fact has not been confirmed.


TODO

Any suggestions are much appreciated.


BUGS

Please report.


VERSION

This man page documents ``Win32::Clock'' version 0.01.

June 9, 1999.


AUTHOR

Mike Blazer, blazer@mail.nevalink.ru

http://www.dux.ru/guest/fno/perl/


SEE ALSO

perl


COPYRIGHT

Copyright (C) 1999 Mike Blazer.

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.