1

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.

Supertux
  • 121
  • 1
  • 5
  • 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? –  Sep 09 '09 at 14:45
  • The recurring nightmare...use NTP and pray. – Michael Foukarakis Sep 09 '09 at 14:48
  • 1
    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 08:12

5 Answers5

15

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.

unwind
  • 334
  • 2
  • 4
  • 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. –  Sep 09 '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 09 '09 at 15:08
4

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.

JimB
  • 1,924
  • 12
  • 15
3

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.

damorg
  • 1,198
  • 6
  • 10
1

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

wRAR
  • 292
  • 1
  • 6
0

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

adopilot
  • 1,501
  • 6
  • 25
  • 40