# [ntp:questions] A question about the NTP delay time formula

Brian Utterback brian.utterback at sun.com
Wed Jun 24 17:09:25 UTC 2009

```When you think that there is a mistake in an RFC, it is wise to check
the RFC errata list at http://www.rfc-editor.org/errata_list.php

In the list, you will see that Dr. Mills reported this typo back in 2001.

Terje Mathisen wrote:
> Lei wrote:
>> In RFC 2030(written by Prof. D.Mills), we have roundtrip delay time
>> formula as follows:
>>
>>  d = (T4 - T1) - (T2 - T3) .................(1)
>>
>> However, IMHO, it should be
>>
>>  d = (T4-T1) - (T3 - T2)....................(1)'
>
> This is the same as
>
>   d = -T1 + T2 -T3 +T4
> or
>   d = (T2-T1) - (T3-T4)
>
> right?
>
> "Use the source, Luke" :-)
>
>  From ntp_proto.c, around line 1200:
>>      * Let t1 = p_org, t2 = p_rec, t3 = p_xmt, t4 = peer->rec:
>>      */
>>     ci = p_xmt;            /* t3 - t4 */
>>     L_SUB(&ci, &peer->rec);
>>     LFPTOD(&ci, t34);
>>     ci = p_rec;            /* t2 - t1 */
>>     L_SUB(&ci, &p_org);
>>     LFPTOD(&ci, t21);
>
> I.e Dr. Mills have here calculated (T3-T4) and (T2-T1), both of which
> should be small (normally positive) numbers, and the difference between
> them is the same as in your formula.
>
> The conclusion is that I'm almost certain you've found a typo in the RFC:
>
> The total on-network-cable time must of course be the total time from
> request to reply (T4-T1), minus the time spent inside the server
> (T3-T2), so your second version is correct.
>
> Assuming the RFC does indeed use the first form, that would also be
> against the written description of the algorithm.
>
> Terje
>

```