Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

[VB6] SNTPClient UserControl

$
0
0
This is a basic Simple Network Time protocol (SNTP) client UserControl based on a Winsock control that can be used to retrieve time from NIST Internet Time Servers or local NTP servers on your LAN.

It includes a 4 second "delay" to prevent overuse (minimum of 4.1 seconds between Query method calls) with an Unblock event to signal when another request can be made. See the NIST page linked above.

Since NTP servers return UTC (GMT) time, there is also a method to convert the UTC result returned through the Response event to local time. Response also returns the Source of the time as reported by the time server (if any). Typical values are listed in RFC 5905 as:

Code:

    +------+----------------------------------------------------------+
    | ID  | Clock Source                                            |
    +------+----------------------------------------------------------+
    | GOES | Geosynchronous Orbit Environment Satellite              |
    | GPS  | Global Position System                                  |
    | GAL  | Galileo Positioning System                              |
    | PPS  | Generic pulse-per-second                                |
    | IRIG | Inter-Range Instrumentation Group                        |
    | WWVB | LF Radio WWVB Ft. Collins, CO 60 kHz                    |
    | DCF  | LF Radio DCF77 Mainflingen, DE 77.5 kHz                  |
    | HBG  | LF Radio HBG Prangins, HB 75 kHz                        |
    | MSF  | LF Radio MSF Anthorn, UK 60 kHz                          |
    | JJY  | LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz      |
    | LORC | MF Radio LORAN C station, 100 kHz                        |
    | TDF  | MF Radio Allouis, FR 162 kHz                            |
    | CHU  | HF Radio CHU Ottawa, Ontario                            |
    | WWV  | HF Radio WWV Ft. Collins, CO                            |
    | WWVH | HF Radio WWVH Kauai, HI                                  |
    | NIST | NIST telephone modem                                    |
    | ACTS | NIST telephone modem                                    |
    | USNO | USNO telephone modem                                    |
    | PTB  | European telephone modem                                |
    +------+----------------------------------------------------------+

These are not particularly useful in most programs though.


The attached demo shows use of the SNTPClient control, which is included in the attached archive.

Name:  sshot sntp demo.png
Views: 2
Size:  9.6 KB

To use the control in your own programs just copy SNTPClient.ctl and SNTPClient.ctx to your Project folder and add the module to your Project.
Attached Images
 
Attached Files

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>