The only way to do this without shelling out to the net time command is
to use the SetLocalTime() API from Kernel32.dll.

####################################

#Mad, mad props to G.Knauf, [EMAIL PROTECTED]
#He has a script on the Internets that I used as an example

use strict;
use warnings;
use Win32::API::Prototype;

ApiLink( 'kernel32.dll', 'BOOL SetLocalTime( LPSYSTEM  lpSystemTime )' )
|| die("import of SetLocalTime() failed!\n");

#NOTE:  Go here for a definition of the input parameter:
#http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinf
o/base/systemtime_str.asp

my $lpSystemTime = pack("S8", 2005, 8, 4, 18, 15, 30, 0, 0);
SetLocalTime($lpSystemTime) || die("Couldn't set the system time!\n");

#####################################




-----Original Message-----
From: Xiaofang Zhou [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 17, 2003 4:59 PM
To: beginners@perl.org
Subject: How to change the date/time of PC

Hi,

I can't find any perl function to change the date/time of PC.
The only way I found is `cmd.exe /C date $today`, call DOS function.
Any one can give me a clue?


Thanks,
            Xiaofang Zhou
            [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to