tags:

views:

237

answers:

4

I am sending real-time-critical data over the internet between two dedicated computers, using my own protocol.

There is, of course, latency involved.

For debugging and optimization, I like to have both computers use the same timebase. I.e, I need to know the time difference of their clocks so that I can judge the latencies better.

Of course, relativism and such doesn't really allow me to sync them perfectly, but I like to get as close as possible.

Relying on NTP alone does not appear good enough - clocks can be off by half a second in my experience (clarification: I relied so far on the default one provided by Apple).

I need precision in the 1/10s range, at least. The two computers won't be too far apart, ICMP ping times are less than 100ms, usually.

Any suggestions how to do this?

(currently, the machines involved run OS X, so if you know a solution just for them, that'll be a start)

+8  A: 

Get the time from a GPS receiver connected to the machines. If they are in a data centre it can be difficult getting an antenna into a location that it can get a lock though unfortunately.

andynormancx
+1. A research group I used to work for used GPS to synchronize over 80 data collecting machines scattered over Los Angeles. They were measuring events occurring at different stations within 50 us. Worked extremely well.
Jay Conrod
I don't have GPS receivers for those Macs. But if I had, this would sound as the best solution. Thanks.
Thomas Tempelmann
+7  A: 

I would suggest that your best bet is to install an ntp server on one of the machines and get the other to sync to it.

Visage
Alright, I'll try that.
Thomas Tempelmann
+2  A: 

Did you try to have one of the machine as NTP server for the other? May be they won't be in sync with the 'real' time but this may bring you within the precision you require.

David Segonds
+2  A: 

Relying on NTP alone does not appear good enough - clocks can be off by half a second in my experience.

That's strange. NTPd over Internet is supposed to give you much greater precision.

vartec