ActiveX: AtomicClock (Filename: SLATOMIC.OCX)
![]()
| AtomicClock is an
ActiveX control
that allows you to retrieve the current time from time servers on the Internet.
These time servers often use an atomic clock to obtain their time so the
retrieved time is always very accurate. You can use the AtomicClock control in any application where you need to have accurate time/date stamps, including financial transactions, medical data, long-term data collection, or anywhere else where a reliable time-stamp is needed. You can also use this control to synchronize a computers system clock with an atomic clock at Internet. The control can handle both NTP and NIST time servers. The time can be obtained both as local time and as Greenwich Mean Time (GMT). |
Properties
| Name | Type | Description |
| Correction | Long | Specifies how many milliseconds the obtained time should be corrected after arrival. It
takes some time to for the data packet to arrive from the time server to
your local computer and you can with this property set a value that should
be added to the arrived time. |
| DateStr | String | Returns the date as a string (converted to
local date) that the time server has returned. |
| DelayBetweenReads | Long | Specifies the allowed minimum
time (in milliseconds) between two reads of a time server. If you read a
time server several times, you should wait a time before you read again
otherwise your time requests may be ignored for a time. The default value
for this property is 3000 ms. |
| GMTDateStr | String | Returns the date as a string in Greenwich Mean Time
(GMT) that the
time server has returned. |
| GMTTimeStr | String | Returns the time as a string in Greenwich Mean Time
(GMT) that the
time server has returned. |
| RemotePort | Long | Specifies which port to read at
a time server. For NIST servers it's normally port 13 and for NTP servers
it's normally port 37. |
| ServerName | String | Specifies the domain name of the
time server. |
| ServerType | Short | Specifies the type of server to
read. 0 = NIST and 1 = NTP. |
| SyncSystemTime | Boolean | If this property has the value True
the system clock of the local computer will be synchronized with the
received atomic clock time. If this property has the False no such
adjustment will occur. |
| TimeStr | String | Returns the time as a string (converted to
local time) that the time server has returned. |
Events
| Name | Description |
| TimeReceived | This event occurs when date and
time information has arrived to the local computer. The date and time can
be obtained by reading the DateStr,
TimeStr, GMTDateStr
and GMTTimeStr properties. |
Methods
CancelRead () As Boolean Cancel the waiting for a time data packet. If the time do not arrive in a specified amount of time you can call this method to cancel the waiting.
GetLastError () As Long GetNumNISTServers
() As Short GetNumNTPServers
() As Short GetNumServers
() As Short GetServerResponseTime
() As Long ReadTime
() As Boolean SelectServer (ServerIndex
As Integer) |
Example
Private Sub Command1_Click()
AtomicClock1.ReadTime
' Send a read time
request
End Sub
Private Sub AtomicClock1_TimeReceived()
Label1 = AtomicClock1.TimeStr '
Write the arrived time to a label on the form
End Sub
![]()