Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running some benchmarks between a Windows client and Linux server. In order to measure the latency correctly I need to synchronize the clocks between the two machines before starting the test - ideally down to the nearest millisecond - what's the easiest way to achieve this?

I don't need to do this repeatedly, just once manually, so it doesn't need to be always in sync or automated.

share|improve this question
1  
I think your best bet to measure latency would be to send a packet there, have the receiver then send a packet back, and halve the round-trip time. What's wrong with this approach? –  Walt W Sep 9 '09 at 14:45
    
The recurring nightmare...use NTP and pray. –  Michael Foukarakis Sep 9 '09 at 14:48
    
Walt W. approach is quite bad, specially since nothing quarantees that the two paths are identical and, even if they are, that the two times are identical. This solution was possible 20 years ago, now we have much better algorithms such as those of NTP. –  bortzmeyer Sep 14 '09 at 8:12
add comment

migrated from stackoverflow.com Sep 9 '09 at 15:07

This question came from our site for professional and enthusiast programmers.

5 Answers

up vote 15 down vote accepted

Make both machines be NTP clients. That should make their clocks correct to within a rather short interval, and is already developed, tested, and available.

According to the Wikipedia page on NTP, you should expect around 10 ms over Internet, far less if you have a local time server on your LAN, which should be quite easy to set up.

share|improve this answer
    
I agree, set up both clients to be NTP clients. Optionally, install an NTP server on the linux box (which is pretty straight forward) and sync the windows box with it. –  Ariejan Sep 9 '09 at 14:48
    
Note that you can use the ntpd -q option if you just want it to synchronize once and then quit, rather than run continuously. –  mark4o Sep 9 '09 at 15:08
add comment

Probably belongs on serverfault, but you're looking for ntp (Network Time Protocol). The daemon on linux is ntpd, and I think it's "Windows Time Service Tools" on windows.

share|improve this answer
add comment

Just something to watch out for...may not practically apply if the test you're doing is fairly short in duration:

Be aware of the time synchronization interval, especially if the Windows client is in a domain (where the domain source and interval would override anything you set manually for your test).

It might muddy your results if you sync the times manually and one or both of the machines being measured re-synch their times from another source while the benchmark is running.

share|improve this answer
add comment

I think Samba may act as a time server which can be used with net time on Windows clients.

share|improve this answer
add comment

If You need atomic time you can try to find solution in this question

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.