CN102195766A - Time synchronization method and clock device - Google Patents

Time synchronization method and clock device Download PDF

Info

Publication number
CN102195766A
CN102195766A CN2010101165963A CN201010116596A CN102195766A CN 102195766 A CN102195766 A CN 102195766A CN 2010101165963 A CN2010101165963 A CN 2010101165963A CN 201010116596 A CN201010116596 A CN 201010116596A CN 102195766 A CN102195766 A CN 102195766A
Authority
CN
China
Prior art keywords
sync message
jumping
ptp sync
message
clockwork
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2010101165963A
Other languages
Chinese (zh)
Other versions
CN102195766B (en
Inventor
徐鹏飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN 201010116596 priority Critical patent/CN102195766B/en
Publication of CN102195766A publication Critical patent/CN102195766A/en
Application granted granted Critical
Publication of CN102195766B publication Critical patent/CN102195766B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a time synchronization method and a clock device, the limitation of a block port on a precision time protocol (PTP) synchronization message is cancelled, a local clock is amended according to the PTP synchronization message transmitted from an optimal path, as the hop count of routing of the PTP synchronization message is minimal, the cumulative error is also minimal and the time synchronization precision is further improved. Furthermore, when the PTP synchronization message is received through a slave port and the clock device has a master port, after clock information carried in the PTP message is amended, the master port is used for forwarding the PTP synchronization message so as to enable the follow-up clock device to conveniently perform precision time synchronization.

Description

A kind of method of time synchronized and clockwork
Technical field
The present invention relates to network communications technology field, particularly a kind of method of time synchronized and clockwork.
Background technology
The IEEE1588 agreement is a kind of comparatively accurate clock synchronization solution in the Ethernet, and its basic function is that other clock in the distributed network is kept synchronously with precision clock.Defined a kind of Precision Time Protocol (PTP in the IEEE1588 agreement, Precision Time Protocol), be used for adopting the clock of network node of the distributed bus system of multicasting technology to carry out precise synchronization to standard ethernet or other, its precision can reach nanosecond.
In network, can clock priority be set for each clockwork usually; each clockwork elects the highest clockwork of clock priority by send announcement (Announce) message carry self clock priority in network; the clockwork that this clock priority is the highest is commonly referred to source clock (GM), thereby and the calculating of carrying out port role form and to generate tree synchronously.GM equipment periodically sends the PTP sync message that carries clock information along generating tree synchronously then, non-GM equipment is revised the clock of this locality according to the clock information that carries in the PTP sync message that receives, follow-up non-GM equipment carries the PTP sync message of revising the back clock information with also continuing to transmit, so that can carry out the local clock correction according to correction back clock information.
Clock synchronization is with the agreement of avoiding network Cheng Huan sometimes and deposits, for example RSTP (RSTP), rapid ring protection protocol (RRPP), link technology (SMLK) etc. flexibly.In service in these agreements can be blocked the certain port of network node.The port of these obstructions not only abandons the data message, also can abandon the PTP sync message in the PTP agreement, and this PTP sync message that usually can cause non-GM node to receive not is to receive from optimum link.
As shown in Figure 1, in the networking that network node C1, C2, C3 and C4 constitute, owing to moved the RSTP agreement, blocked the port P2 on port P1, the C4 on the C3, the root node of RSTP is C1.But usually the synchronous generation tree that forms of PTP does not overlap with the generation tree that RSTP forms, i.e. root node and inequality suppose that the root node that the synchronous generation of PTP formation is set is that GM is C2, and synchronous path of its time is among Fig. 1 shown in the arrow so.For C3, the time synchronized path be C2 to C1, again from C1 to C3, need revise through twice time, for more excellent path C2 to C3 owing to the restriction of port blocked P1 then can not be used.Because along with the increase of node jumping figure on the time synchronized path, error can be accumulated, precision also can decrease, and clock synchronization mode of the prior art obviously can not obtain last precision.
Summary of the invention
In view of this, the invention provides a kind of method and apparatus of time synchronized, so that improve the precision of time synchronized.
After a kind of method of time synchronized, clockwork receive the PTP sync message by slave port or port blocked, carry out following steps:
A, from described PTP sync message, obtain the jumping figure of the synchronous spanning-tree root node of distance P TP;
B, the jumping figure that steps A is obtained and the jumping figure of local record compare, if the jumping figure that obtains is less than or equal to the jumping figure of record, execution in step C; Otherwise execution in step E;
C, determine that the path of described slave port or port blocked correspondence is current optimal path, utilize the clock information that carries in the described PTP sync message that local clock is revised, if the jumping figure that the described jumping figure that obtains less than the jumping figure of record, further utilizes steps A to obtain upgrades the jumping figure of local record;
If the described PTP sync message of D receives by the slave port, and there is the master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, transmit this PTP sync message, process ends by the master port; Otherwise abandon described PTP sync message, process ends;
If the described PTP sync message of E receives by the slave port, and there is main master port in described clockwork, after then utilizing current local clock information that the clock information that carries in the described PTP message is revised and upgrading the distance P TP that carries in the PTP sync message and generate the jumping figure of tree node synchronously, transmit this PTP sync message by the master port; Otherwise abandon described PTP sync message.
A kind of clockwork, this clockwork comprises: packet sending and receiving unit and jumping figure acquiring unit, path comparing unit, first amending unit and second amending unit;
Described packet sending and receiving unit after being used for receiving the PTP sync message by slave port or port blocked, offers described jumping figure acquiring unit with this PTP sync message; Transmit the PTP sync message that described first amending unit or second amending unit provide by the master port;
Described jumping figure acquiring unit is used for obtaining from described PTP sync message the jumping figure of the synchronous spanning-tree root node of described clockwork distance P TP;
Described path comparing unit, being used for the jumping figure that described jumping figure acquiring unit is obtained and the jumping figure of local record compares, if the jumping figure that obtains is less than or equal to the jumping figure of record, the path of then determining described slave port or port blocked correspondence is current optimal path, sends to described first amending unit and revises notice; Otherwise send the correction notice to described second amending unit;
Described first amending unit, after being used to receive the correction notice, utilize the clock information that carries in the described PTP sync message that local clock is revised, if the described jumping figure that obtains less than the jumping figure of record, further utilizes the described jumping figure that obtains to upgrade the jumping figure of local record; If described PTP sync message receives by the slave port, and there is the master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, this PTP message is offered described packet sending and receiving unit; Otherwise abandon the PTP sync message;
Described second amending unit, after being used to receive the correction notice, if described PTP sync message receives by the slave port, and there is the master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP message is revised, after the distance P TP that carries in the renewal PTP sync message generates the jumping figure of tree node synchronously, this PTP message is offered described packet sending and receiving unit; Otherwise abandon the PTP sync message.
As can be seen from the above technical solutions, the present invention has cancelled the restriction of port blocked for the PTP sync message, according to the PTP sync message that comes from the optimal path transmission local clock is revised, and the PTP sync message be receive by the slave port and this clockwork when having the master port, after the clock information that carries in the PTP message revised, transmit this PTP sync message so that subsequent clock equipment can carry out exact time synchronization by the master port.The correction of among the present invention local clock being carried out is the PTP sync message that comes according to the optimal path transmission that jumping figure information is determined, because the jumping figure minimum of approach, the error accumulation that it brought is also minimum, thereby has improved the precision of time synchronized.
Description of drawings
Fig. 1 is the networking schematic diagram of RSTP and PTP coexistence;
Fig. 2 is a main method flow chart provided by the invention;
Fig. 3 generates the formation method flow diagram of tree synchronously for PTP;
Fig. 4 generates the tree schematic diagram synchronously for the formed PTP of networking shown in Figure 1;
Fig. 5 postpones the deviation calculation process schematic diagram of mechanism for end;
Fig. 6 is the deviation calculation process schematic diagram of request-reply mechanism;
Fig. 7 is the structural representation of clockwork provided by the invention.
Embodiment
In order to make the purpose, technical solutions and advantages of the present invention clearer, describe the present invention below in conjunction with the drawings and specific embodiments.
In the prior art, clockwork is directly done discard processing for the PTP sync message that receives by port blocked, core concept of the present invention is that port blocked is no longer limited the PTP sync message, and clockwork also participates in local clock correction for the PTP sync message that receives by port blocked.Main method provided by the invention can mainly may further comprise the steps as shown in Figure 2:
Step 201: clockwork obtains the jumping figure of the synchronous spanning-tree root node of distance P TP by after receiving the PTP sync message from (slave) port or port blocked from this PTP sync message.
In the PTP sync message, there is a field StepsRemoved, this field record the jumping figure from the synchronous spanning-tree root node of PTP to present clock equipment, each clockwork is all safeguarded this field, when root node, this field is designated as 0 and jumps, whenever, all the jumping figure of this field indication is added 1 through one section communication link, wherein this communication link does not comprise the link between ordinary clock (OC) or boundary clock (BC) and the transparent clock (TC), that is to say, the StepsRemoved field is every during through an OC or BC at the PTP sync message, the jumping figure of indication is added 1, then do not change the jumping figure of StepsRemoved field indication through TC.
In the PTP agreement, port blocked can not be calculated as the slave port, in the prior art, and the transmission of this port blocked restriction PTP message, and in the present invention, cancelled the restriction of port blocked to the PTP message.
Step 202: the jumping figure that step 201 is obtained and the jumping figure of local record compare, if the jumping figure that obtains is less than or equal to the jumping figure of record, and execution in step 203; If the jumping figure that obtains is greater than the jumping figure of record, then execution in step 205.
Step 203: utilize the clock information that carries in the PTP sync message that receives that local clock is revised, if the jumping figure that the jumping figure that obtains less than the jumping figure of record, further utilizes step 201 to obtain upgrades the jumping figure of local record.
The jumping figure of the PTP sync message that receives is littler than the jumping figure of local record, illustrate that the path that receives the PTP sync message is more excellent, as current optimal path, utilize this PTP sync message that local clock is revised, concrete correcting mode will be described in subsequent embodiment.
Step 204: if above-mentioned PTP sync message receives by the slave port, and there is the master port in clockwork, then utilize current local clock information that the clock information that carries in the PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, transmit this PTP sync message by the master port, otherwise abandon this PTP sync message; Process ends.
Step 205: if above-mentioned PTP sync message receives by the slave port, and there is the master port in clockwork, then utilize current local clock information that the clock information that carries in the PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, transmit this PTP sync message by the master port, otherwise abandon this PTP sync message.
If the jumping figure of the PTP sync message that receives is bigger than the jumping figure of local record, illustrate that the path that receives the PTP sync message is not optimum, then exist under the situation of master port, utilize the jumping figure of local record and clock information that the jumping figure and the clock information that carry in the PTP sync message are revised at clockwork.
For above-mentioned steps 203 or step 205, whether the path that no matter receives the PTP sync message is optimum, does not do further forwarding for the PTP sync message that receives by port blocked; Under the situation that has the master port, do further forwarding for the PTP sync message that receives by the slave port, otherwise abandon described PTP sync message.In addition, before doing further forwarding, the clock information that needs to carry in step 204 or the step 205 pair PTP sync message is done correction so that next jumps the exact time synchronization of clockwork, and concrete modification method is done specific descriptions in subsequent embodiment.
The understanding of the present invention is for convenience at first simply described the formation that PTP generates tree synchronously.Usually when carrying out networking, can clock priority be set for each clockwork, clock priority can constitute the priority vector with other parameter in each clockwork, utilizes this priority vector to carry out the election of GM.Be specially: each clockwork elects the highest clockwork of priority vector by send the notification packet carry self priority vector in network, be GM, generate the root node of tree synchronously as PTP, thereby and carry out port setting formation generation synchronously and set.Each clockwork receives the performed operation of notification packet as shown in Figure 3, mainly may further comprise the steps:
Step 301: the priority vector of each clockwork record self under the initial conditions, and original records this locality is GM.
Step 302: after receiving notification packet by the unblock port, the priority vector that carries in this notification packet and the priority vector of local record are compared, if the priority vector height that carries in the notification packet, then execution in step 303; If the priority vector height of local record, then execution in step 304.
If receive notification packet, then directly do discard processing by port blocked.
After clockwork receives notification packet, also may carry out verification to the legitimacy of notification packet, determine legal after, just carry out the compare operation of above-mentioned clock priority; If illegal, then directly abandon.
Step 303: upgrade the local non-GM that is recorded as, if there has been the slave port, the slave port that has then existed is set to the master port; The port of receiving notification packet is set to the slave port, utilizes the priority vector that carries in the notification packet to upgrade the priority vector of local record, and continues to transmit this notification packet.Go to step 302 after treating to receive notification packet once more.
Step 304: abandon this notification packet; After treating to receive notification packet once more, go to step 302.
Through behind the said process, if final local record is the clockwork of GM still, be the highest equipment of priority vector, become the GM that is finally elected, the local record of other clockwork is non-GM.The final PTP that forms as shown in Figure 4 of clockwork in the networking shown in Figure 1 generates tree synchronously, generate in the tree synchronously at this PTP, clockwork receives the PTP sync message by the slave port from other clockwork, and sends the PTP sync message by the master port to other clockwork.
Below in conjunction with specific embodiment method provided by the present invention is described in detail.In order to make the PTP sync message no longer be subjected to the restriction of port blocked, the target MAC (Media Access Control) address unification of PTP sync message can be adopted the reserved address of IEEE 802.1AS protocol definition, i.e. 0180-C200-000E.Configuration comprises the ACL list item of this 0180-C200-000E on each clockwork, this ACL list item points to the software processing module of clockwork, even if make clockwork receive the PTP sync message by port blocked, also handle, and no longer directly abandon delivering to software processing module on this PTP sync message.
Be example with the clockwork C3 in the framework shown in Figure 1 below, can be so that the jumping figure information of C3 original records be a default maximum, this maximum is greater than maximum hop count possible in the networking.By two kinds of situations said method is described respectively below.
First kind of situation: C3 at first receives the PTP sync message from slave port P3.
If C3 at first receives the PTP sync message from slave port P3, then from the PTP sync message, obtain the jumping figure of the synchronous spanning-tree root node of this C3 distance P TP C2, promptly 2 jump, the jumping figure of itself and local record is compared, because the C3 original records is the maximum hop count of presetting, therefore, the jumping figure that obtains from the PTP sync message is little, then utilizes the clock information that carries in the PTP sync message that receives that local clock is revised.
At this, need to prove, under the single step time synchronizing method, carry clock information by time synchronized (Sync) message, under two step time synchronizing methods, carry clock information by following (Follow_Up) message closely, therefore, the PTP sync message that relates in the present invention can be Sync message or Follow_Up message.
When revising, utilize the clock information that carries in the PTP sync message to calculate deviation (Offset) between local clock and the accurate clock, this deviation is local clock and the deviate between the accurate clock, the i.e. Offset that calculates by the slave port Slave, utilize this Offset then SlaveLocal clock is revised, be about to local clock and add the Offset that calculates SlaveAs the revised clock information in this locality.Wherein, the calculation deviation value can adopt request-reply (Req_Resp) mechanism or end time-delay (Peer_Delay) mechanism, and the account form of these two kinds of mechanism is a prior art.
Below the computational methods of Offset in above-mentioned Req_Resp mechanism and the Peer_Delay mechanism are simply introduced.Usually a last jumping equipment is as master clock, and the conduct of this clockwork is from clock.
Master clock and as shown in Figure 5 in the Peer_Delay mechanism from the Offset computational process between the clock.Master clock carries clock information t1 in the Sync message when sending the Sync message, when adopting under two step modes, this t1 also can carry by the Follow_Up message, the time of this t1 sign master clock this locality.Slave unit recorder is to the time t2 of this Sync message, and this t2 is the time of slave unit this locality, and returns a Pdelay_Req message to main equipment, and record returns the time t3 of this Pdelay_Req message.The time t4 of this Pdelay_Req message of main equipment recorder, return the Pdelay_Resp message to slave unit, can carry the time t5 of this Pdelay_Resp message of transmission and the difference between the t4 in this Pdelay_Resp message, also can only carry t4, t5 is carried by a Pdelay_Resp_Follow_UP message again.Then, slave unit utilizes formula Offset=(t2-t1)-T DelayCalculate, wherein, T DelayFor master clock and from the transmission delay between the clock, this T Delay=[(t4-t3)+(t6-t5)]/2 obtain formula Offset=(t2-t1)-[(t4-t3)+(t6-t5)]/2.
Master clock and as shown in Figure 6 in the Req_Resp mechanism from the Offset computational process between the clock.Master clock carries clock information t1 in the Sync message when sending the Sync message, when adopting under two step modes, this t1 also can carry by the Follow_Up message, the time of this tl sign master clock this locality.Slave unit recorder is to the time t2 of this Sync message, and this t2 is the time of slave unit this locality, and returns a Delay_Req message to main equipment, and record returns the time t3 of this Delay_Req message.The time t4 of this Delay_Req message of main equipment recorder returns the Delay_Resp message to slave unit and carries t4.Slave unit utilizes formula Offset=(t2-t1)-T then DelayCalculate, wherein, T DelayFor master clock and from the transmission delay between the clock, this T DelayBe [(t2-t1)-(t4-t3)]/2, therefore, obtain formula Offset=[(t2-t1)-(t4-t3)]/2.
Because the jumping figure that carries in the PTP sync message that receives is less, this clockwork also can utilize the jumping figure of the jumping figure information updating local record that obtains in the PTP sync message, and this moment, the jumping figure of local record was 2 jumpings.
Because above-mentioned PTP sync message receives from the slave port, under the situation that has the master port, need this PTP sync message is transmitted.Before transmitting, the clock information that carries in the PTP sync message need be revised, concrete correcting mode can comprise following two kinds of situations:
1) if adopts the time synchronizing method of request-reply (Req_Resp) mechanism, what carry in the PTP sync message is the local clock information of a last jumping clockwork, and then clockwork can be replaced the revised clock information in this locality the clock information in the PTP sync message.
2) if adopt end time-delay (Peer_Delay) mechanism, what carry in the PTP sync message is the local clock information (being the clock information of GM when sending this PTP sync message) and the deferred message of root node, wherein, deferred message carries in revising field (CorrectionField) usually, comprise transmission delay and postpone in the delay of this clockwork from root node to this clockwork, the deferred message that carries in the clockwork correction PTP sync message then adds that promptly one jumps the transmission delay between clockwork and this clockwork and the delay delay of this clockwork.
Wherein, last one transmission delay of jumping between clockwork and this clockwork can be obtained promptly above-mentioned T in the computational process of Offset DelayThe delay of clockwork postpones can be by this clockwork by obtaining the timing that receives this PTP sync message and send between this PTP sync message.
If afterwards, C3 receives the PTP sync message from port blocked P1 again, and the jumping figure information of the synchronous spanning-tree root node of the distance P TP C2 that obtains from this PTP sync message is 1 jumping, jumps little than the jumping figure 2 of local record.C3 utilizes the clock information that carries in the PTP sync message that receives by port blocked P1 that local clock is revised.When revising, utilize the clock information that carries in the PTP sync message to calculate deviation between local clock and the accurate clock, this deviation is local clock and the deviate between the accurate clock, the i.e. Offset that calculates by port blocked Block, utilize this Offset then BlockLocal clock is revised, local clock is added the Offset that calculates BlockAs the revised clock information in this locality.
Simultaneously, this clockwork also can utilize the jumping figure of the jumping figure information updating local record that obtains in the PTP sync message, and this moment, the jumping figure of local record was 1 jumping.
Because this PTP sync message receives from port blocked, therefore no longer this PTP sync message is further transmitted, abandon this PTP sync message.
Hereafter, follow-up C3 also may receive the PTP sync message from the P3 port, because the jumping figure that obtains from the PTP sync message that the P3 port receives is 2 jumpings, jumps greatly than the jumping figure 1 of current local record, does not then carry out the clock correction.That is to say, only utilize the PTP sync message that receives by port blocked P1 that local clock is revised in the subsequent process.
Second kind of situation: C3 at first receives the PTP sync message from port blocked P1.
If C3 at first receives the PTP sync message from port blocked P1, then at first from the PTP sync message, obtain the jumping figure of the synchronous spanning-tree root node of this C3 distance P TP C2, promptly 1 jump, its jumping figure with local record is compared, the jumping figure that obtains in the obvious PTP sync message is little.At this moment, utilize the clock information that carries in the PTP sync message that receives that local clock is revised.Simultaneously, this C3 also can utilize the jumping figure of the jumping figure information updating local record that obtains in the PTP sync message, and this moment, the jumping figure of local record was 1 jumping.
Because this PTP sync message receives from port blocked P1, no longer transmits this PTP sync message.
If C3 receives the PTP sync message from slave port P3 again afterwards, the jumping figure information of the synchronous spanning-tree root node of the distance P TP C2 that obtains from this PTP sync message is 2 jumpings, jumping figure 1 than local record is jumped greatly, and C3 can not utilize this PTP sync message to carry out the clock correction.But, need when having the master port, transmit this PTP sync message because this PTP sync message receives from slave port P3.Before transmitting, the clock information that carries in this PTP sync message is revised, and the jumping figure information of carrying in the PTP sync message is upgraded.Wherein, the concrete grammar revised of the clock information that the PTP sync message is carried can comprise following two kinds of situations:
1) if adopts the time synchronizing method of Req_Resp mechanism, what carry in the PTP sync message is the local clock information of a last jumping clockwork, because receiving the path of this PTP sync message from C1 is not optimal path, local clock is not revised, can think that current local clock is an accurate clock, then clockwork can be replaced current local clock information the clock information in the PTP sync message.
2) if adopt Peer_Delay mechanism, what carry in the PTP sync message is the local clock information and the deferred message of root node, and wherein, deferred message comprises the transmission delay from root node to this clockwork and postpones in the delay of this clockwork.Because receiving the path of this PTP sync message from the slave port is not optimal path, therefore need utilize the clock of optimal path that the clock information that carries in the PTP sync message is revised.On the deferred message basis of in the PTP sync message, carrying, adding that C1 is to the transmission delay between the C3 and outside the delay on the C3 postpones, also need to add a precision adjusted value, this precision adjusted value is the timing differential value (Δ between this transmission path and the optimal transmission paths Offset), Δ wherein Offset=Offset Best-Offset Slave, wherein, Offset BestFor by the local clock of current optimal path computation and the deviate between the accurate clock, current in the present embodiment optimal path is the path of port blocked correspondence; Offset SlaveBe the local clock that calculates by the slave port and the deviate between the accurate clock.
From then on after, C3 also only can utilize the jumping figure of local record and clock information that the PTP sync message that receives from the P1 port is upgraded.
By above-mentioned two kinds of situations as can be seen, behind use the present invention, C3 has selected more preferably path when carrying out clock synchronization, i.e. the direct-connected path of C2 and C3.If the precision of time device when continuing the clock correction was ± 1 nanosecond, if, then need accumulation through twice ± 1 nanosecond by path C2-C1-C3, by path C2-C3, only once ± 1 the precision of nanosecond obviously, can improve the precision of clock synchronization by method of the present invention.
More than be the detailed description that method provided by the present invention is carried out, below clockwork provided by the present invention be described in detail.Fig. 7 is the structural representation of clockwork provided by the present invention, and as shown in Figure 7, this clockwork can comprise: packet sending and receiving unit 701, jumping figure acquiring unit 702, path comparing unit 703, first amending unit 704 and second amending unit 705.
Packet sending and receiving unit 701 after being used for receiving the PTP sync message by slave port or port blocked, offers jumping figure acquiring unit 702 with this PTP sync message; Transmit the PTP sync message that first amending unit 704 or second amending unit 705 provide by the master port.
Jumping figure acquiring unit 702 is used for obtaining from the PTP sync message jumping figure of the synchronous spanning-tree root node of clockwork distance P TP.
Path comparing unit 703, being used for the jumping figure that jumping figure acquiring unit 702 is obtained and the jumping figure of local record compares, if the jumping figure that obtains is less than or equal to the jumping figure of record, the path of then determining to receive the slave port of this PTP sync message or port blocked correspondence is that current optimal path sends to first amending unit 704 and revises notice; Otherwise send the correction notice to second amending unit 705.。
First amending unit 704, after being used to receive the correction notice, utilize the clock information that carries in the described PTP sync message that local clock is revised, if the described jumping figure that obtains less than the jumping figure of record, further utilizes the described jumping figure that obtains to upgrade the jumping figure of local record; If the PTP sync message receives by the slave port, and there is the master port in clockwork, then utilize current local clock information that the clock information that carries in the PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, this PTP message is offered described packet sending and receiving unit; Otherwise abandon the PTP sync message.
Second amending unit 705, after being used to receive the correction notice, if the PTP sync message receives by the slave port, and there is the master port in clockwork, then utilize current local clock information that the clock information that carries in the PTP sync message is revised, after the distance P TP that carries in the renewal PTP sync message generates the jumping figure of tree node synchronously, this PTP message is offered the packet sending and receiving unit; Otherwise abandon the PTP sync message.
Wherein, the target MAC (Media Access Control) address of above-mentioned PTP sync message can unify to adopt default reserved address, the ACL list item that comprises above-mentioned reserved address that disposes on the clockwork points to the software processing module 710 of this clockwork, and this software processing module 710 comprises above-mentioned jumping figure acquiring unit 702, path comparing unit 703, first amending unit 704 and second amending unit 705.
At this moment, packet sending and receiving unit 701, receive the PTP sync message after, according to the ACL list item PTP sync message is offered software processing module 710.
Particularly, the mode that first amending unit is revised local clock is: utilize the clock information that carries in the PTP sync message to calculate the local clock of clockwork and the deviate between the accurate clock, local clock is added that value that the deviate that calculates obtains is as revised local clock.Wherein, the computational methods of deviate can adopt Req_Resp mechanism, also can adopt Peer_Delay mechanism.
The correcting mode of clock information is in 704 pairs of PTP sync messages of first amending unit: if adopt the time synchronizing method of Req_Resp mechanism, then receive will be current when revising notice local clock replacement PTP sync message in clock information.If adopt the time synchronizing method of Peer_Delay mechanism, then the deferred message in the clock information that the PTP sync message is carried adds that the slave port connects last one and jumps clockwork and postpone in the delay of this clockwork with transmission delay and PTP sync message between this clockwork, the deferred message in the clock information that resulting value replacement PTP sync message is carried.
The correcting mode of clock information is in 705 pairs of PTP sync messages of second amending unit: if adopt the time synchronizing method of Req_Resp mechanism, then receive will be current when revising notice local clock replacement PTP sync message in clock information; If adopt the time synchronizing method of Peer_Delay mechanism, then the deferred message in the clock information that the PTP sync message is carried adds that the slave port connects transmission delay between a last jumping clockwork and this clockwork, PTP sync message delay delay and the precision adjusted value Δ at this clockwork Offset, resulting value is replaced deferred message in the clock information that the PTP sync message carries; Δ wherein Offset=Offset Best-Offset Slave, Offset BestFor by the local clock of current optimal path computation and the deviate between the accurate clock, Offset SlaveBe the local clock that calculates by the slave port and the deviate between the accurate clock.
Above-mentioned PTP sync message can or follow the Follow_Up message closely for time synchronized Sync message.
By above description as can be seen, the present invention has cancelled the restriction of port blocked for the PTP sync message, according to the PTP sync message that comes from the optimal path transmission local clock is revised, and the PTP sync message be receive by the slave port and this clockwork when having the master port, after the clock information that carries in the PTP message revised, transmit this PTP sync message so that subsequent clock equipment can carry out exact time synchronization by the master port.The correction of among the present invention local clock being carried out is the PTP sync message that comes according to the optimal path transmission that jumping figure information is determined, because the jumping figure minimum of approach, the error accumulation that it brought is also minimum, thereby has improved the precision of time synchronized.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.

Claims (10)

1. the method for a time synchronized is characterized in that, clockwork is carried out following steps by after receiving precision clock agreement PTP sync message from slave port or port blocked:
A, from described PTP sync message, obtain the jumping figure of the synchronous spanning-tree root node of distance P TP;
B, the jumping figure that steps A is obtained and the jumping figure of local record compare, if the jumping figure that obtains is less than or equal to the jumping figure of record, execution in step C; Otherwise execution in step E;
C, determine that the path of described slave port or port blocked correspondence is current optimal path, utilize the clock information that carries in the described PTP sync message that local clock is revised, if the jumping figure that the described jumping figure that obtains less than the jumping figure of record, further utilizes steps A to obtain upgrades the jumping figure of local record;
If the described PTP sync message of D receives by the slave port, and there is main master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, transmit this PTP sync message, process ends by the master port; Otherwise abandon described PTP sync message, process ends;
If the described PTP sync message of E receives by the slave port, and there is main master port in described clockwork, after then utilizing current local clock information that the clock information that carries in the described PTP message is revised and upgrading the distance P TP that carries in the PTP sync message and generate the jumping figure of tree node synchronously, transmit this PTP sync message by the master port; Otherwise abandon described PTP sync message.
2. method according to claim 1, it is characterized in that, the unified reserved address of presetting that adopts of the target MAC (Media Access Control) address of described PTP sync message, the ACL list item that comprises described reserved address that disposes on the described clockwork points to the software processing module of described clockwork, requires each step described in 1 by described software processing module enforcement of rights.
3. method according to claim 1, it is characterized in that, if described PTP sync message receives by the slave port, then utilizing the clock information that carries in the described PTP sync message that local clock is revised specifically among the step C comprises: utilize the clock information that carries in the described PTP sync message to calculate the local clock of described clockwork and the deviate between the accurate clock, described local clock is added that value that the deviate that calculates obtains is as revised local clock.
4. method according to claim 1 is characterized in that, utilizes current local clock information that the clock information that carries in the described PTP message is revised specifically among the step D and comprises:
If adopt the time synchronizing method of request-reply Req_Resp mechanism, then current local clock is replaced the clock information in the PTP sync message; If adopt end to postpone the time synchronizing method of Peer_Delay mechanism, then the deferred message in the clock information that described PTP sync message is carried adds the above slave port and connects last one and jump the delay delay at this clockwork of transmission delay between clockwork and this clockwork and described PTP sync message, and resulting value is replaced deferred message in the clock information that described PTP sync message carries;
Utilizing current local clock information that the clock information that carries in the described PTP message is revised specifically in the step e comprises:
If adopt the time synchronizing method of request-reply Req_Resp mechanism, then current local clock is replaced the clock information in the PTP sync message; If the time synchronizing method that adopts end to postpone Peer_Delay mechanism, then the deferred message in the clock information that described PTP sync message is carried adds the above slave port and connects the transmission delay between a last jumping clockwork and this clockwork, described PTP sync message delay delay and the precision adjusted value Δ at this clockwork Offset, resulting value is replaced deferred message in the clock information that described PTP sync message carries; Δ wherein Offset=Offset Best-Offset Slave, Offset BestFor by the local clock of current optimal path computation and the deviate between the accurate clock, Offset SlaveBe the local clock that calculates by described slave port and the deviate between the accurate clock.
5. according to the described method of the arbitrary claim of claim 1 to 4, it is characterized in that described PTP sync message is time synchronized Sync message or follows the Follow_Up message closely.
6. a clockwork is characterized in that, this clockwork comprises: packet sending and receiving unit and jumping figure acquiring unit, path comparing unit, first amending unit and second amending unit;
Described packet sending and receiving unit after being used for receiving the PTP sync message by slave port or port blocked, offers described jumping figure acquiring unit with this PTP sync message; Transmit the PTP sync message that described first amending unit or second amending unit provide by the master port;
Described jumping figure acquiring unit is used for obtaining from described PTP sync message the jumping figure of the synchronous spanning-tree root node of described clockwork distance P TP;
Described path comparing unit, being used for the jumping figure that described jumping figure acquiring unit is obtained and the jumping figure of local record compares, if the jumping figure that obtains is less than or equal to the jumping figure of record, the path of then determining described slave port or port blocked correspondence is current optimal path, sends to described first amending unit and revises notice; Otherwise send the correction notice to described second amending unit;
Described first amending unit, after being used to receive the correction notice, utilize the clock information that carries in the described PTP sync message that local clock is revised, if the described jumping figure that obtains less than the jumping figure of record, further utilizes the described jumping figure that obtains to upgrade the jumping figure of local record; If described PTP sync message receives by the slave port, and there is the master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP sync message is revised, and after upgrading the distance P TP that carries in the PTP sync message and generating the jumping figure of tree node synchronously, this PTP message is offered described packet sending and receiving unit; Otherwise abandon the PTP sync message;
Described second amending unit, after being used to receive the correction notice, if described PTP sync message receives by the slave port, and there is the master port in described clockwork, then utilize current local clock information that the clock information that carries in the described PTP sync message is revised, after the distance P TP that carries in the renewal PTP sync message generates the jumping figure of tree node synchronously, this PTP message is offered described packet sending and receiving unit; Otherwise abandon the PTP sync message.
7. clockwork according to claim 6, it is characterized in that, the unified reserved address of presetting that adopts of the target MAC (Media Access Control) address of described PTP sync message, the ACL list item that comprises described reserved address that disposes on the described clockwork points to the software processing module that comprises described jumping figure acquiring unit, path comparing unit, first amending unit and second amending unit;
Described packet sending and receiving unit, receive described PTP sync message after, according to described ACL list item described PTP sync message is offered described software processing module.
8. clockwork according to claim 6, it is characterized in that, described first amending unit, specifically utilize the clock information that carries in the described PTP sync message to calculate the local clock of described clockwork and the deviate between the accurate clock, described local clock is added that value that the deviate that calculates obtains is as revised local clock.
9. clockwork according to claim 6 is characterized in that, described first amending unit if be used for adopting the time synchronizing method of Req_Resp mechanism, is then replaced current local clock the clock information in the PTP sync message; If adopt the time synchronizing method of Peer_Delay mechanism, deferred message in the clock information that described PTP sync message is carried adds the above slave port and connects last one and jump the delay delay at this clockwork of transmission delay between clockwork and this clockwork and described PTP sync message, and resulting value is replaced deferred message in the clock information that described PTP sync message carries.
Second amending unit, if be used for adopting the time synchronizing method of Req_Resp mechanism, then receive will be current when revising notice local clock replacement PTP sync message in clock information; If adopt the time synchronizing method of Peer_Delay mechanism, the deferred message in the clock information that described PTP sync message is carried adds the above slave port and connects the transmission delay between a last jumping clockwork and this clockwork, described PTP sync message delay delay and the precision adjusted value Δ at this clockwork Offset, resulting value is replaced deferred message in the clock information that described PTP sync message carries; Δ wherein Offset=Offset Best-Offset Slave, Offset BestFor by the local clock of current optimal path computation and the deviate between the accurate clock, Offset SlaveBe the local clock that calculates by the slave port and the deviate between the accurate clock.
10. according to the described method of the arbitrary claim of claim 6 to 9, it is characterized in that described PTP sync message is time synchronized Sync message or follows the Follow_Up message closely.
CN 201010116596 2010-03-01 2010-03-01 Time synchronization method and clock device Active CN102195766B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010116596 CN102195766B (en) 2010-03-01 2010-03-01 Time synchronization method and clock device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010116596 CN102195766B (en) 2010-03-01 2010-03-01 Time synchronization method and clock device

Publications (2)

Publication Number Publication Date
CN102195766A true CN102195766A (en) 2011-09-21
CN102195766B CN102195766B (en) 2013-12-25

Family

ID=44603194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010116596 Active CN102195766B (en) 2010-03-01 2010-03-01 Time synchronization method and clock device

Country Status (1)

Country Link
CN (1) CN102195766B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102511149A (en) * 2011-11-24 2012-06-20 华为技术有限公司 Output time method for minitoring network node, device and system thereof
CN103051439A (en) * 2011-10-14 2013-04-17 中兴通讯股份有限公司 Method and device for selecting clock source
CN103312429A (en) * 2013-06-08 2013-09-18 杭州华三通信技术有限公司 Time synchronization method and time synchronization device
CN103929294A (en) * 2014-05-05 2014-07-16 浙江大学 Clock synchronization system and method
CN104092528A (en) * 2014-07-14 2014-10-08 杭州华三通信技术有限公司 Clock synchronization method and device
TWI484811B (en) * 2012-09-11 2015-05-11 Mitsubishi Electric Corp Correction parameter calculation device and correction parameter calculation system and correction parameter calculation method and computer program product
CN105027489A (en) * 2013-12-20 2015-11-04 华为技术有限公司 Precision time protocol synchronization method and node
CN105634637A (en) * 2015-12-22 2016-06-01 大唐电信(成都)信息技术有限公司 PTP and SYNC-E fused time-frequency synchronization method
CN105634714A (en) * 2014-10-28 2016-06-01 中兴通讯股份有限公司 Cross-domain clock synchronization method, device thereof and cross-domain clock synchronization system
CN106936610A (en) * 2015-12-30 2017-07-07 中国移动通信集团公司 A kind of network synchronous control method and device
WO2018072273A1 (en) * 2016-10-17 2018-04-26 国电南瑞科技股份有限公司 Message delay measurement and correction method based on bidirectional hsr ring network
CN108039933A (en) * 2017-12-05 2018-05-15 南京沃旭通讯科技有限公司 A kind of local Internet of Things time precise synchronization method
CN108683472A (en) * 2018-05-09 2018-10-19 西安电子科技大学昆山创新研究院 A kind of clock synchronizing method based on Time delay measurement
CN109068384A (en) * 2018-08-23 2018-12-21 平安科技(深圳)有限公司 A kind of method for synchronizing time and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022369A (en) * 2007-03-23 2007-08-22 中山大学 End-to-end quening time delay measuring method
CN101110820A (en) * 2007-09-04 2008-01-23 杭州华三通信技术有限公司 Method and switchboard for processing spanning tree protocol message
US20080069150A1 (en) * 2006-09-19 2008-03-20 Sig Harold Badt Precision Time Protocol Emulation for Network Supportive of Circuit Emulation Services
CN101616163A (en) * 2009-07-27 2009-12-30 中兴通讯股份有限公司 Precise time transfer protocol message processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080069150A1 (en) * 2006-09-19 2008-03-20 Sig Harold Badt Precision Time Protocol Emulation for Network Supportive of Circuit Emulation Services
CN101022369A (en) * 2007-03-23 2007-08-22 中山大学 End-to-end quening time delay measuring method
CN101110820A (en) * 2007-09-04 2008-01-23 杭州华三通信技术有限公司 Method and switchboard for processing spanning tree protocol message
CN101616163A (en) * 2009-07-27 2009-12-30 中兴通讯股份有限公司 Precise time transfer protocol message processing method and device

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103051439B (en) * 2011-10-14 2017-10-10 中兴通讯股份有限公司 A kind of method and device of selection clock source
CN103051439A (en) * 2011-10-14 2013-04-17 中兴通讯股份有限公司 Method and device for selecting clock source
WO2013075307A1 (en) * 2011-11-24 2013-05-30 华为技术有限公司 Method, device and system for monitoring output time of network node
CN102511149B (en) * 2011-11-24 2014-03-12 华为技术有限公司 Output time method for minitoring network node, device and system thereof
CN102511149A (en) * 2011-11-24 2012-06-20 华为技术有限公司 Output time method for minitoring network node, device and system thereof
TWI484811B (en) * 2012-09-11 2015-05-11 Mitsubishi Electric Corp Correction parameter calculation device and correction parameter calculation system and correction parameter calculation method and computer program product
CN103312429A (en) * 2013-06-08 2013-09-18 杭州华三通信技术有限公司 Time synchronization method and time synchronization device
CN103312429B (en) * 2013-06-08 2015-11-25 杭州华三通信技术有限公司 A kind of method for synchronizing time and device
CN105027489B (en) * 2013-12-20 2018-08-21 华为技术有限公司 Precision clock protocol synchronization method and node
CN105027489A (en) * 2013-12-20 2015-11-04 华为技术有限公司 Precision time protocol synchronization method and node
CN103929294A (en) * 2014-05-05 2014-07-16 浙江大学 Clock synchronization system and method
CN103929294B (en) * 2014-05-05 2017-09-12 浙江大学 A kind of clock system and synchronous method
CN104092528B (en) * 2014-07-14 2017-06-06 新华三技术有限公司 A kind of clock synchronizing method and device
CN104092528A (en) * 2014-07-14 2014-10-08 杭州华三通信技术有限公司 Clock synchronization method and device
CN105634714A (en) * 2014-10-28 2016-06-01 中兴通讯股份有限公司 Cross-domain clock synchronization method, device thereof and cross-domain clock synchronization system
CN105634637A (en) * 2015-12-22 2016-06-01 大唐电信(成都)信息技术有限公司 PTP and SYNC-E fused time-frequency synchronization method
CN106936610A (en) * 2015-12-30 2017-07-07 中国移动通信集团公司 A kind of network synchronous control method and device
CN106936610B (en) * 2015-12-30 2020-01-24 中国移动通信集团公司 Network synchronization control method and device
WO2018072273A1 (en) * 2016-10-17 2018-04-26 国电南瑞科技股份有限公司 Message delay measurement and correction method based on bidirectional hsr ring network
CN108039933A (en) * 2017-12-05 2018-05-15 南京沃旭通讯科技有限公司 A kind of local Internet of Things time precise synchronization method
CN108683472A (en) * 2018-05-09 2018-10-19 西安电子科技大学昆山创新研究院 A kind of clock synchronizing method based on Time delay measurement
CN109068384A (en) * 2018-08-23 2018-12-21 平安科技(深圳)有限公司 A kind of method for synchronizing time and system

Also Published As

Publication number Publication date
CN102195766B (en) 2013-12-25

Similar Documents

Publication Publication Date Title
CN102195766B (en) Time synchronization method and clock device
US10862601B1 (en) Bridges including physical layer devices for indicating transmission times of synchronization frames by modifying previously generated corresponding follow up frames
US10432336B2 (en) System and method of synchronizing a distributed clock in a packet-compatible network
US8913514B2 (en) Communication control unit and communication control system
EP2541815B1 (en) Clock synchronization network
US9577774B2 (en) Time synchronization method and system
US9548833B2 (en) Method, apparatus and system for time distribution in a telecommunications network
KR101426325B1 (en) Network element for a packet-switched network
US8995473B2 (en) Ring based precise time data network clock phase adjustments
US20150016478A1 (en) Network distributed packet-based synchronization
KR101488233B1 (en) Non-intrusive method for synchronizing master and slave clocks of a packet-switched network, and associated synchronization devices
JP5518191B2 (en) Method and system for optical transmission network carrying time synchronization protocol
RU2638645C2 (en) Method for identification of reference clock signals subjected to asymmetry changes to delay propagation path between nodes in communication network
CN102026364B (en) Precise time protocol message processing method and clock equipment
JP7401656B2 (en) METHODS, APPARATUS AND SYSTEM AND STORAGE MEDIA FOR SELECTING CLOCK SOURCES
CN102457346A (en) Time synchronization realizing method and clock node
WO2013178148A1 (en) Clock synchronization method and device for communication network
WO2017177751A1 (en) Time synchronization method and apparatus
WO2016112664A1 (en) Time processing method and device
JP5426695B2 (en) Method for synchronizing clocks by separately transmitting first data and second data by at least one timing distribution protocol, and related systems and modules
CN107959537B (en) State synchronization method and device
CN102195996B (en) Time synchronization method for stacking system, stacking system and member equipment
CN101902291B (en) Method, equipment and system for precise time synchronization
Diarra et al. Improved clock synchronization start-up time for Ethernet AVB-based in-vehicle networks
WO2022151993A1 (en) Method, device and system for detecting time synchronization performance

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No.

Patentee after: Xinhua three Technology Co., Ltd.

Address before: 310053 Hangzhou hi tech Industrial Development Zone, Zhejiang province science and Technology Industrial Park, No. 310 and No. six road, HUAWEI, Hangzhou production base

Patentee before: Huasan Communication Technology Co., Ltd.

CP03 Change of name, title or address