Release date: November 20, 2011
Platform: .NET Framework
- Complete ZIP package - contains everything from .NET executable to C# source code and a list of public time servers around the world.
Overview of the Simple Network Time Protocol (SNTP)
The Simple Network Time Protocol (SNTP) is a protocol for synchronizing the clocks of computer systems over packet-switched, variable-latency data networks. SNTP uses UDP port 123 as its transport layer. It is designed particularly to resist the effects of variable latency. SNTP uses Marzullo’s algorithm with the UTC time scale, including support for features such as leap seconds. SNTPv4 can usually maintain time to within 10 milliseconds (1/100 s) over the Internet, and can achieve accuracies of 200 microseconds (1/5000 s) or better in local area networks under ideal conditions.
SNTP is one of the oldest internet protocols still in use (since before 1985). SNTP was originally designed by Dave Mills of the University of Delaware, who still maintains it, along with a team of volunteers.
SNTP uses a hierarchical system of “clock strata”, where stratum 1 systems are synchronized to an accurate external clock such as a GPS clock or other radio clock. SNTP stratum 2 systems derive their time from one or more stratum 1 systems, and so on. (Note that this is different from the notion of clock strata used in telecom systems)
The 64-bit timestamps used by SNTP consist of a 32-bit seconds part and a 32-bit fractional second part, giving SNTP a time scale of 232 seconds (136 years), with a theoretical resolution of 2−32 seconds (0.233 nanoseconds). Although the SNTP timescale wraps round every 232 seconds, implementations should disambiguate SNTP time using a knowledge of the approximate time from other sources. Since this only requires time accurate to a few decades, this is not a problem in general use.
About the C# SNTP Client
This is a free C# implementation of the SNTP, as documented in the RFC 2030. Although this piece of code is not a technical marvel, I am posting it because this was my very first C# program back in 2001. It has been updated wth contributions from others since then, but the sentimental value is here to stay :-)
How this code ended up in .NET Compact Framework
I was contacted by Lorenzo Tessiore of Microsoft which asked for permission to use my code in Microsoft .NET Compact Framework. Since this code is public anyway, I agreed.