NTP同步过程 联系客服

发布时间 : 星期六 文章NTP同步过程更新完毕开始阅读d48bf96df111f18583d05a88

roundtrip 延迟和时钟补偿计算如下:

Ti?3,Ti?2,Ti?1,Ti分别表示pkt.org , ptk.rec , pkt.xmt和peer.rec,主机相对于peer的时钟补偿

?,roundtrip延迟?和散布?表示如下

??(Ti?Ti-3)(-Ti-1?Ti-2) ??(Ti-2?Ti-3)?(Ti-1?Ti)

2??(1??sys.precision)??(Ti?Ti-3)6.5 Clock-Update Procedure

当有效的时钟补偿,延迟和散布数据被clock-filter鉴别后,由receive procedure呼叫clock-update过程。

begin clock-update procedure

call clock-select; /* select clock source */ if(sys.peer ≠ peer) exit;

当本地时钟被重置后,clear procedure进程被呼叫用来清除每个peer的clock filter,重置poll interval和重新选择同步源。

Note that the local-clock procedure sets the leap bits sys.leap to “unsynchronized” 112in this case, so that no other peer will attempt to synchronize to the host until the host once again selects a peer for synchronization.

根据上文计算的root延迟、散布、root 同步距离,会进行判断,若计算得到的距离大于NTP.MAXDISTANCE,那么主机就不会与这个选定的peer进行时钟同步。

?andistance(peer); /* update system variables */

if(Λ ≥ NTP.MAXDISTANCE) exit; sys.leap ←peer.leap;

sys.stratum ←peer.stratum +1; sys.refid ←peer.peeraddr; call local-clock;

if(local clock reset) begin /* if reset, clear state variables */ sys.leap ←112;

for(all peers) call clear; endif

else begin

sys.peer ← peer; /* if not, adjust local clock */ sys.rootdelay ← ?;

sys.rootdispersion ← Ε+max(????, NTP.MINDISPERSE);

endif

sys.reftime ←sys.clock; endclock-update procedure;

NTP的精度受到本地硬件时钟固有的框架的影响;

由于时钟速率间的微小差别和peers间精度的差异都会给时间同步的计算带来误差;

NTP itself is described in Section 3. It provides the protocol mechanisms to synchronize time in principle to precisions in the order of nanoseconds while preserving a non-ambiguous date well into the next century.

Since most host time servers will synchronize via another peer time server, there are two

components in each of these three products,those determined by the peer relative to the primary reference source of standard time and those measured by the host relative to the peer. Each of these components are maintained separately in the protocol in order to facilitate error control and management of the subnet itself. They provide not only precision measurements of offset and delay, but also definitive maximum error bounds, so that the user interface can determine not only the time, but the quality of the time as well.