4

NTP 如何计算往返延迟时间和偏移量。

4

1 回答 1

6

要将其时钟与远程服务器同步,NTP 客户端必须计算往返延迟时间和偏移量。往返延迟计算为

delta = (t_3 - t_0) - (t_2- t_1)

在哪里

t0 is the client's timestamp of the request packet transmission,
t1 is the server's timestamp of the request packet reception,
t2 is the server's timestamp of the response packet transmission and
t3 is the client's timestamp of the response packet reception. 

所以

t3 − t0 is the time elapsed on the client side between the emission 
        of the request packet and the reception of the response packet and
t2 − t1 is the time the server waited before sending the answer.

偏移 theta 由下式给出

theta = ((t_1 - t_0) + (t_2 - t_3))/2

当客户端和服务器之间的传入和传出路由都具有对称的标称延迟时,NTP 同步是正确的。如果路线没有共同的标称延迟,则同步的系统偏差为前向和后向旅行时间差的一半。

必须有两种方式的通信以允许同步。使用 NTP 时间作为来自 NTP 服务器的广播会在时间上留下未知错误。

于 2013-09-13T06:41:44.410 回答