|
The Time protocol control enables an application to retrieve the
current time from a remote system, and optionally synchronize the
local system time using that value. The first step that your
application must take is to initialize the control. After the
control has been initialized, the application can request the
current time from a system and update the local system clock if
necessary.
Initialize
Initialize the control and load the Windows Sockets control for the
current process. This method is normally not used if the control is
placed on a form in languages such as Visual Basic. However, if the
control is being created dynamically using a method similar to
CreateObject, then the application must call this method to
initialize the component before setting any properties or calling
any other methods in the control.
GetTime
Return the current time from a remote host. The time and date
retrieved from the server will be returned as a string formatted
according to the user's current locale. If the date could not be
retrieved, an empty string will be returned.
SetTime
Update the local system time with the value returned by GetTime. On
Windows NT and later versions of the operating system, this method
requires that the current user have the appropriate permissions to
modify the system time or the method will fail.
Uninitialize
Unload the Windows Sockets library and release any resources that
have been allocated for the current process. This is the last
method call that the application should make prior to terminating.
This is only necessary if the application has previously called the
Initialize method.
Time Conversion
The control also provides several properties which can be used
to convert between the local date and time and UTC date and time
for the value returned by the remote host. These properties
are:
LocalDate
This property returns the network date and adjusts the value for
the local timezone. The date is returned as a string formatted
using the Short Date format for the current locale.
LocalTime
This property returns the network time and adjusts the value for
the local timezone. The time is returned as a string formatted
using the standard format for the current locale.
SystemDate
This property returns the network date in Coordinated Universal
Time (UTC). The date is returned as a string formatted using the
Short Date format for the current locale.
SystemTime
This property returns the network time in Coordinated Universal
Time (UTC). The time is returned as a string formatted using the
standard format for the current locale.
|