Friday, July 1, 2011

Internet Synchronized clock using C#. Part 1

Task – show clock that is synchronized with some internet time server.

In this part I’ll just try to get UTC time from the server and in Part 2 I’ll use this code to create simple clock.
Some search pointed me to the http://tf.nist.gov/tf-cgi/servers.cgi page. It contains list of servers placed in US which provide UTC time on demand. Another page from that site (http://www.nist.gov/pml/div688/grp40/its.cfm) gives information about supported protocols. One of the is Network Time Protocol (RFC-1305) and another one is Daytime Protocol (RFC-867). Network Time Protocol (NTP) is a little bit more complicated and it provides more features. Daytime Protocol is simpler, but it should be just enough for this task.