SocketTools .NET Edition

NetworkTime.SetTime Method (Int64)

Set the local system clock to the specified date and time.

[Visual Basic]
Overloads Public Function SetTime( _
   ByVal networkTime As Long _
) As Boolean
[C#]
public bool SetTime(
   long networkTime
);

Parameters

networkTime
A long integer which specifies the date and time the local system clock should be set to.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. to get extended error information, check the value of the LastError property.

Remarks

The SetTime method updates the local system clock to the the date and time returned by the time server. 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.

The network time must be expressed as the number of seconds elapsed since midnight, January 1, 1900 UTC.

See Also

NetworkTime Class | SocketTools Namespace | NetworkTime.SetTime Overload List