3

I need the precise time between two time stamps from a remote computer and to eliminate any difference due to the transmission time of signals to and from my computer. I have an NTP program running to do this and think that all I need to do is correct for the differences in transmission time that might occur. I don't require the precise time only the difference between the two readings.

I have been looking at the Wikipedia entry for Network Time Protocol under the sub heading of Clock Synchronisation Protocol Network time protocol but find it confusing. (It looks like there is an error in the formula for time offset, $\theta$, which they have as $$ \theta = \frac{(t_1-t_0)-(t_2-t_3)}{2}, $$ and I think should be $$ \theta = \frac{(t_1-t_0)-(t_3-t_2)}{2}. $$ In the figure they seem to have labelled $\delta$ as $35$ milliseconds which surely is $\theta$ and $\delta$ is $2$ms.

I don't understand how to use the right combination of these time intervals to eliminate the error due to time delay in sending and return and the difference in client time and server time values. Can any one help please?

Sammy Black
  • 25,273
user36093
  • 145
  • 4
  • 1
    If the purpose is to compute the time between two timestamps from a remote computer, I don't see why you need to worry about NTP, transmission times, and so forth. At some time, the remote computer records timestamp $t_A$ from its own clock. At a later time, the remote computer records timestamp $t_B$ from its own clock. Provided the clock is not defective, the time between those two events is $t_B-t_A$ seconds. The time between the events will still be $t_B-t_A$ when your computer has received both $t_A$ and $t_B$, regardless of how long transmission takes or how out of synch the clocks are. – David K Jul 11 '23 at 01:22
  • The remote computer will only send the time when requested. If the time it takes to receive the request is different there will be an error. – user36093 Jul 11 '23 at 22:18
  • 1
    In order for the words "precise time between" to mean anything, you must describe two events between which you want to measure the precise time. What are your two events? The only candidates I see in your question are the event on the remote computer that creates the first timestamp, and the event on the remote computer that creates the second timestamp. You literally said you wanted the time between those two timestamps. That "time between" is literally measured on the remote computer. Transmission times have nothing to do with it. – David K Jul 12 '23 at 01:57
  • 1
    If you actually have a question where transmission times are relevant, then you should describe it differently. You need two events. If both events occur on the same computer then (once again) transmission times are irrelevant, because the computer precisely measures the time between two events that it itself performed. So you need one event to occur on one computer, and the other event to occur on the other computer. When you have figured out which events those are, we can discuss how transmission times affect the measurement of the time between them. – David K Jul 12 '23 at 02:01

1 Answers1

5

You have misquoted the Wikipedia expression as it has a $+$ sign between the terms in the numerator while you have a $-$ sign. Their expression is equivalent to the one you propose. They have listed $\delta$ as $65$ ms, which is the result of the computation they give. It gives the total time for both message transits. $\theta$ is the amount you should add to the client time to make it match the server. Another way to write $\theta$ is $$\theta = \frac {t_2+t_1}2-\frac {t_3+t_0}2$$ which makes it clear that it is the difference between the two clocks at the midpoint of the exchange.

Ross Millikan
  • 374,822