0 votes
by (230 points)

If my aim is to make sure time gets synchronized then which protocol should I use and which server should I use?

i.e. what would a Generic.SynchronizeSystemClock() method do?

Which would be the most reliable or should they be tried in some order in case the first fails:

// synchronize over NTP protocol Ntp.SynchronizeSystemClock("pool.ntp.org");

// synchronize over TIME protocol Time.SynchronizeSystemClock("test.rebex.net");

// synchronize over DAYTIME protocol Daytime.SynchronizeSystemClock("test.rebex.net");

[ from http://www.rebex.net/time.net/ ]

Also, are these good servers to use?


Applies to: Rebex Time

1 Answer

+1 vote
by (18.0k points)
Best answer

The only precise time synchronization can be done using the NTP protocol. It uses time in sub-second accuracy and accounts for clock drift automatically. However, NTP works over the UDP protocol only, which may not be allowed in some networks.

The TIME and DAYTIME protocols differ in internal time format only (encapsulated inside the Rebex Time component). They both can choose between TCP or UDP underlying protocols.

According to used servers - the "test.rebex.net" is intended just for testing and does not guarantee a very precise time. When using the "pool.ntp.org" directly, you have to keep ntp.org vendor rules.

The best choice is to run your own NTP server(s) and synchronize its clock with some well known server (e.g. to become a vendor of ntp.org). Then your application does not directly depend on any 3rd party server.

by (230 points)

Great to know - as we do not wish to run our own time servers are there any 3rd party TIME/DAYTIME and NTP servers you would recommend for use in production environment. In general, my understanding is to query ntp first then and if that fails try TIME or DAYTIME over TCP..

by (18.0k points)

Yes, it is better to query several NTP servers first and only if your network does not allow to connect using UDP, then try some TIME or DAYTIME servers.

Unfortunately, I cannot recommend you any special time servers. If your application does not run worldwide, you should find some server in your geographic region. And again - if you are not running a time server, you should connect to secondary (stratum 2) time server - not to overload the primary time servers.

A country-oriented list of secondary NTP servers can be found here: http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers