[ntp:questions] Re: Question about synchronizing client and server clock
Richard B. Gilbert
rgilbert88 at comcast.net
Mon Jan 5 13:13:35 UTC 2004
Given a low latency network connection between each of the machines and
a time server plus a lot of luck, you might be able to keep the two
clocks synchronized within 100usec using NTP. If you purchase and
install a high quality GPS timing receiver for each machine you might
keep them synchronized to within 100nsec but there is no way that I can
think of that you can ever be sure what the offset between the two
machines is at any given time though you could make statistical
inferences; e.g. the machines are usually within X usec or nsec of each
Your uncertainty increases with the distance between the two machines;
if they are in the same room you could use the same Pulse Per Second
tick with equal cable lengths from source to machine and then the
difference between the two machines should be close to the difference
between their interrupt latencies. If the two machines are hundreds of
miles apart the uncertainties are much greater.
If you have lots of money for hardware and experts you may be able to do it.
I'd be interested to know what problem you are trying to solve.
Synchronization this close is usually of interest only to Radio
Astronomers, Nuclear Physicists, etc.
Atri Mandal wrote:
> Hi ,
> I am writing a client server code using WINSOCK 2.0 in which I have to
> calculate the exact time required by a piece of message to go from the
> client to the server or vice versa.
> i.e Suppose I have a client server model in which A is the client and
> B is the server.
> Let's say A has to send a message M to B by socket communication. I
> want the exact time taken by M to go from A to B.
> Currently I'm sending the message from A to B and then sending an
> acknowledgement from B to A(ack having the same size as original
> message) and then calculating the total time T taken for the round
> trip(this is easy because I just need 2 timer function calls
> within the client). Then I'm assuming that the time taken for A-B is
> T/2. This is however not precise because it might take a longer time
> to go from A-B rather than B-A.
> So is there any way I can calculate the exact one way communication
> time (with the precision at microsecond level or better) ?
> I think the best way is to use a synchronized clock for the client and
> server - Can anyone in this group please tell me how to implement this
> or give me pointers to example source code. I am quite new to this field.
More information about the questions