BOOL SetTime( |
|
DWORD dwNetworkTime |
|
); |
BOOL SetTime( |
|
LPSYSTEMTIME lpSystemTime |
|
); |
The SetTime method sets the local system clock to the
specified date and time.
Parameters
- dwNetworkTime
- The date and time the system clock should be set to,
represented as the number of seconds since midnight, 1 January
1900.
- lpSystemTime
- A pointer to a SYSTEMTIME
structure that specifies the date and time that the local clock
should be set to.
Return Value
If the method is able to update the local time, it returns a
non-zero value. If the specified time is invalid, or the user does
not have the access rights to change the system clock, the method
returns zero.
Remarks
The SetTime method updates the local
system clock to the the specified date and time. The user must have
the appropriate privileges to change the system clock, otherwise an
error will be returned. This typically requires the application to
execute with elevated privileges.
Because Windows systems are usually configured to automatically
synchronize the system clock with a time server using the Windows Time
service (W32Time), most applications should not use this method.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cstimv11.lib
See Also
ConvertTime,
GetTime
|