NTP如何计算往返延迟时间和偏移量。
答案 0 :(得分:3)
要使其时钟与远程服务器同步,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 = ((t_1 - t_0) + (t_2 - t_3))/2
当客户端和服务器之间的传入和传出路由都具有对称的标称延迟时,NTP同步是正确的。如果路线没有共同的标称延迟,则同步系统偏差为前进和后退行程时间差异的一半。
必须进行双向通信才能实现同步。使用NTP时间作为NTP服务器的广播将在时间上留下未知错误。