CN102195766B - Time synchronization method and clock device - Google Patents

Time synchronization method and clock device Download PDF

Info

Publication number
CN102195766B
CN102195766B CN 201010116596 CN201010116596A CN102195766B CN 102195766 B CN102195766 B CN 102195766B CN 201010116596 CN201010116596 CN 201010116596 CN 201010116596 A CN201010116596 A CN 201010116596A CN 102195766 B CN102195766 B CN 102195766B
Authority
CN
China
Prior art keywords
sync message
ptp sync
jumping
clockwork
message
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.)
Active
Application number
CN 201010116596
Other languages
Chinese (zh)
Other versions
CN102195766A (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

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)
  • Small-Scale Networks (AREA)

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 synchronous solution in Ethernet, and its basic function is that other clock in distributed network is synchronizeed with precision clock maintenance.Defined a kind of Precision Time Protocol (PTP in the IEEE1588 agreement, Precision Time Protocol), clock for the network node of the distributed bus system that standard ethernet or other adopted to multicasting technology carries out precise synchronization, and its precision can reach nanosecond.
Usually can clock priority be set for each clockwork in network; each clockwork elects by send announcement (Announce) message carry self clock priority in network the clockwork that clock priority is the highest; 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 synchronous spanning tree.Then GM equipment periodically sends along synchronous spanning tree the PTP sync message that carries clock information, non-GM equipment is revised local clock according to the clock information carried in the PTP sync message received, follow-up non-GM equipment carries by also continuing to forward the PTP sync message of revising rear clock information, so that can carry out the local clock correction according to clock information after correction.
Clock synchronous is with the agreement of avoiding network Cheng Huan sometimes and deposits, such as RSTP (RSTP), rapid ring protection protocol (RRPP), flexible link technology (SMLK) etc.In service in these agreements, can be blocked the certain port of network node.The port of these obstructions is not only abandoned the data message, in the PTP agreement, to the PTP sync message, also can be abandoned, 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 form, owing to having moved the RSTP agreement, blocked the port P2 on port P1, the C4 on C3, the root node of RSTP is C1.But the synchronous spanning tree that usually PTP forms does not overlap with the spanning tree that RSTP forms, root node is not identical, supposes that the root node of the synchronous spanning tree of PTP formation is that GM is C2, and synchronous path of its time is in Fig. 1 shown in arrow so.For C3, the time synchronized path be C2 to C1, then from C1 to C3, need to revise through twice time, for more excellent path C2 to C3 because the restriction of port blocked P1 can not be used.Due to the increase along with node jumping figure on the time synchronized path, error can be accumulated, and 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.
A kind of method of time synchronized, after clockwork receives the PTP sync message by slave port or port blocked, carry out following steps:
A, obtain the jumping figure of the synchronous spanning-tree root node of distance P TP from described PTP sync message;
The jumping figure of B, the jumping figure that steps A is obtained and local record compares, if the jumping figure obtained is less than or equal to the jumping figure of record, and execution step C; Otherwise execution step E;
C, determine that described slave port or path corresponding to port blocked are current optimal path, utilize the clock information carried in described PTP sync message to be revised local clock, if the jumping figure obtained described is less than the jumping figure of record, further utilizes jumping figure that steps A obtains to upgrade 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, utilize current local clock information to be revised the clock information carried in described PTP sync message, and after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat, process ends; 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 utilizing current local clock information to be revised the clock information carried in described PTP message and upgrading the jumping figure of the synchronous spanning tree node of the distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat; Otherwise abandon described PTP sync message.
A kind of clockwork, this clockwork comprises: packet sending and receiving unit and jumping figure acquiring unit, path comparison unit, the first amending unit and the second amending unit;
Described packet sending and receiving unit, after by slave port or port blocked, receiving the PTP sync message, offer described jumping figure acquiring unit by this PTP sync message; The PTP sync message provided by described the first amending unit of master port repeat or the second amending unit;
Described jumping figure acquiring unit, for obtaining the jumping figure of the synchronous spanning-tree root node of described clockwork distance P TP from described PTP sync message;
Described path comparison unit, for jumping figure that described jumping figure acquiring unit is obtained and the jumping figure of local record, compare, if the jumping figure obtained is less than or equal to the jumping figure of record, determine that described slave port or path corresponding to port blocked are current optimal path, to described the first amending unit, send and revise notice; Otherwise send and revise notice to described the second amending unit;
Described the first amending unit, after receiving the correction notice, utilize the clock information carried in described PTP sync message to be revised local clock, the jumping figure obtained if described is less than the jumping figure of record, further utilizes the described jumping figure obtained 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, utilize current local clock information to be revised the clock information carried in described PTP message, and, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP message is offered to described packet sending and receiving unit; Otherwise abandon the PTP sync message;
Described the second amending unit, after receiving the correction notice, if described PTP sync message receives by the slave port, and there is the master port in described clockwork, utilize current local clock information to be revised the clock information carried in described PTP message, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP message is offered to 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 come from the optimal path transmission, local clock is revised, and the PTP sync message be by the slave port, receive and this clockwork while having the master port, after the clock information carried in the PTP message is revised, by this PTP sync message of master port repeat so that subsequent clock equipment can carry out exact time synchronization.The correction of in the present invention, local clock being carried out is the PTP sync message that the optimal path transmission definite according to jumping figure information comes, and due to the jumping figure minimum of approach, its error accumulation brought is also minimum, thereby has improved the precision of time synchronized.
The accompanying drawing explanation
Fig. 1 is the networking schematic diagram that RSTP and PTP coexist;
Fig. 2 is main method flow chart provided by the invention;
The formation method flow diagram that Fig. 3 is the synchronous spanning tree of PTP;
Fig. 4 is the synchronous spanning tree schematic diagram of the formed PTP of networking shown in Fig. 1;
Fig. 5 is the deviation computational process schematic diagram of end delay mechanism;
The deviation computational process schematic diagram that Fig. 6 is request-reply mechanism;
The structural representation that Fig. 7 is clockwork provided by the invention.
Embodiment
In order to make the purpose, technical solutions and advantages of the present invention clearer, below in conjunction with the drawings and specific embodiments, describe the present invention.
In the prior art, clockwork is directly done discard processing for the PTP sync message received 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 received by port blocked.Main method provided by the invention can as shown in Figure 2, mainly comprise the following steps:
Step 201: clockwork, by from (slave) port or port blocked receive the PTP sync message, obtains the jumping figure of the synchronous spanning-tree root node of distance P TP from this PTP sync message.
There is a field StepsRemoved in the PTP sync message, this field record the jumping figure from the synchronous spanning-tree root node of PTP to present clock equipment, each clockwork is safeguarded this field, when root node, this field is designated as 0 jumping, every jumping figure of all this field being indicated through one section communication link adds 1, wherein this communication link does not comprise the link between ordinary clock (OC) or boundary clock (BC) and 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 to 1, 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 obtained is less than or equal to the jumping figure of record, perform step 203; If the jumping figure obtained is greater than the jumping figure of record, perform step 205.
Step 203: utilize the clock information carried in the PTP sync message receive to be revised local clock, if the jumping figure obtained is less than the jumping figure of record, further utilize jumping figure that step 201 is obtained to upgrade the jumping figure of local record.
The jumping figure of the PTP sync message received is less 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 to be revised local clock, 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, utilize current local clock information to be revised the clock information carried in the PTP sync message, and after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat, 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, utilize current local clock information to be revised the clock information carried in the PTP sync message, and after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat, otherwise abandon this PTP sync message.
If the jumping figure of the PTP sync message received is larger than the jumping figure of local record, illustrate that the path that receives the PTP sync message is not optimum,, in the situation that there is the master port in clockwork, utilize the jumping figure of local record and clock information to be revised the jumping figure and the clock information that carry in the PTP sync message.
For above-mentioned steps 203 or step 205, whether the path that no matter receives the PTP sync message is optimum, for the PTP sync message received by port blocked, does not do further forwarding; In the situation that exist the master port to do further forwarding, otherwise abandon described PTP sync message for the PTP sync message received by the slave port.In addition, before doing further forwarding, the clock information that needs to carry in step 204 or step 205 pair PTP sync message is done and is revised so that the exact time synchronization of down hop clockwork, and concrete modification method is done specific descriptions in subsequent embodiment.
In order to facilitate the understanding of the present invention, at first the formation of the synchronous spanning tree of PTP is simply described.Usually when carrying out networking, can clock priority be set for each clockwork, in each clockwork, clock priority can form the priority vector together with other parameter, 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, as the root node of the synchronous spanning tree of PTP, thereby and carry out the port setting and form synchronous spanning tree.Each clockwork receives the performed operation of notification packet as shown in Figure 3, mainly comprises the following steps:
Step 301: under initial conditions, each clockwork records the priority vector of self, 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 carried in notification packet is high, perform step 303; If the priority vector of local record is high, perform step 304.
If receive notification packet by port blocked, directly do discard processing.
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, directly abandon.
Step 303: upgrade the local non-GM that is recorded as, if there has been the slave port, the slave port existed is set to the master port; The port of receiving notification packet is set to the slave port, utilizes the priority vector carried in notification packet to upgrade the priority vector of local record, and continues to forward this notification packet.Go to step 302 after again receiving notification packet.
Step 304: abandon this notification packet; After again receiving notification packet, go to step 302.
After said process, if final local record is still the clockwork of GM, be the highest equipment of priority vector, become the GM finally elected, the local record of other clockwork is non-GM.The final synchronous spanning tree of PTP formed as shown in Figure 4 of clockwork shown in Fig. 1 in networking, in the synchronous spanning tree of 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 subject to the restriction of port blocked, the unification of the target MAC (Media Access Control) address of PTP sync message can be adopted to the reserved address of IEEE 802.1AS protocol definition, i.e. 0180-C200-000E.On each clockwork, configuration packet is containing the ACL list item of this 0180-C200-000E, 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 by this PTP sync message, delivering to software processing module, processed, and no longer directly abandoned.
The clockwork C3 in framework shown in Fig. 1 of below take is example, can be so that the jumping figure information of C3 original records be a default maximum, and this maximum is greater than maximum hop count possible in networking.Below by two kinds of situations, said method is described respectively.
At first the first situation: C3 receives the PTP sync message from slave port P3.
If at first C3 receives the PTP sync message from slave port P3, from the PTP sync message, obtain the jumping figure of the synchronous spanning-tree root node of this C3 distance P TP C2,2 jump, the jumping figure of itself and local record is compared, due to the C3 original records is default maximum hop count, therefore, the jumping figure obtained from the PTP sync message is little, utilizes the clock information carried in the PTP sync message received to be revised local clock.
At this, it should be noted that, 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 related in the present invention can be Sync message or Follow_Up message.
When being revised, utilize the clock information carried in the PTP sync message to calculate the deviation (Offset) between local clock and accurate clock, this deviation is local clock and the deviate between accurate clock, the i.e. Offset calculated by the slave port slave, then utilize this Offset slavelocal clock is revised, be about to local clock and add the Offset calculated 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 prior art.
Below the computational methods of Offset in above-mentioned Req_Resp mechanism and Peer_Delay mechanism are simply introduced.Usually upper hop equipment is as master clock, and this clockwork is as from clock.
Master clock and from the Offset computational process between clock as shown in Figure 5 in Peer_Delay mechanism.Master clock, when sending the Sync message, carries clock information t1 in the Sync message, and 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.Receive the time t2 of this Sync message from equipment records, this t2 is the time from equipment this locality, and returns to a Pdelay_Req message to main equipment, and record returns to the time t3 of this Pdelay_Req message.The main equipment record receives the time t4 of this Pdelay_Req message, to return to the Pdelay_Resp message from equipment, can carry the time t5 of this Pdelay_Resp message of transmission and the difference between t4 in this Pdelay_Resp message, also can only carry t4, t5 is carried by a Pdelay_Resp_Follow_UP message again.Then, from equipment utilization formula Offset=(t2-t1)-T delaycalculated, wherein, T delayfor master clock and from the transmission delay between clock, this T delay=[(t4-t3)+(t6-t5)]/2, obtain formula Offset=(t2-t1)-[(t4-t3)+(t6-t5)]/2.
Master clock and from the Offset computational process between clock as shown in Figure 6 in Req_Resp mechanism.Master clock, when sending the Sync message, carries clock information t1 in the Sync message, and 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.Receive the time t2 of this Sync message from equipment records, this t2 is the time from equipment this locality, and returns to a Delay_Req message to main equipment, and record returns to the time t3 of this Delay_Req message.The main equipment record receives the time t4 of this Delay_Req message, to return to the Delay_Resp message from equipment, carries t4.Then from equipment utilization formula Offset=(t2-t1)-T delaycalculated, wherein, T delayfor master clock and from the transmission delay between clock, this T delayfor [(t2-t1)-(t4-t3)]/2, therefore, obtain formula Offset=[(t2-t1)-(t4-t3)]/2.
Because the jumping figure carried in the PTP sync message received is less, this clockwork also can utilize the jumping figure of the jumping figure information updating local record obtained in the PTP sync message, and now the jumping figure of local record is 2 jumpings.
Because above-mentioned PTP sync message receives from the slave port, in the situation that there is the master port, need this PTP sync message is forwarded.Before being forwarded, the clock information carried in the PTP sync message need to be revised, concrete correcting mode can comprise following two kinds of situations:
1) if adopt the time synchronizing method of request-reply (Req_Resp) mechanism, what in the PTP sync message, carry is the local clock information of upper hop clockwork, and clockwork can be replaced the clock information in the PTP sync message by the revised clock information in this locality.
2) if adopt end time delay (Peer_Delay) mechanism, what in the PTP sync message, carry is local clock information (being the clock information of GM while sending this PTP sync message) and the deferred message of root node, wherein, deferred message carries usually in revising field (CorrectionField), comprise transmission delay from root node to this clockwork and postpone in the delay of this clockwork, the deferred message carried in clockwork correction PTP sync message, the delay that adds transmission delay between upper hop clockwork and this clockwork and this clockwork postpones.
Wherein, the transmission delay between upper hop clockwork and this clockwork can be obtained in the computational process of Offset, i.e. above-mentioned T delay; The 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 obtained from this PTP sync message is 1 jumping, than the jumping figure of local record 2, jumps little.C3 utilizes the clock information carried in the PTP sync message received by port blocked P1 to be revised local clock.When being revised, utilize the clock information carried in the PTP sync message to calculate the deviation between local clock and accurate clock, this deviation is local clock and the deviate between accurate clock, the i.e. Offset calculated by port blocked block, then utilize this Offset blocklocal clock is revised, local clock is added to the Offset calculated 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 obtained in the PTP sync message, and now the jumping figure of local record is 1 jumping.
Because this PTP sync message receives from port blocked, therefore no longer this PTP sync message is further forwarded, abandon this PTP sync message.
Hereafter, follow-up C3 also may receive the PTP sync message from the P3 port, because the jumping figure obtained the PTP sync message received from the P3 port is 2 jumpings, than the jumping figure of current local record 1, jumps greatly, does not carry out the clock correction.That is to say, in subsequent process, only utilize the PTP sync message received by port blocked P1 to be revised local clock.
At first the second situation: C3 receives the PTP sync message from port blocked P1.
If at first C3 receives the PTP sync message from port blocked P1, 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,1 jump, the jumping figure by it with local record compares, and the jumping figure obtained in obvious PTP sync message is little.Now, utilize the clock information carried in the PTP sync message received to be revised local clock.Simultaneously, this C3 also can utilize the jumping figure of the jumping figure information updating local record obtained in the PTP sync message, and now the jumping figure of local record is 1 jumping.
Because this PTP sync message receives from port blocked P1, no longer forward 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 obtained from this PTP sync message is 2 jumpings, than the jumping figure of local record 1, jump greatly, C3 can not utilize this PTP sync message to carry out the clock correction.But, because this PTP sync message receives from slave port P3, need to when having the master port, to this PTP sync message, be forwarded.Before forwarding, the clock information carried 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 that the clock information PTP sync message carried is revised can comprise following two kinds of situations:
1) if adopt the time synchronizing method of Req_Resp mechanism, what in the PTP sync message, carry is the local clock information of upper hop clockwork, because the path that receives this PTP sync message from C1 is not optimal path, local clock is not revised, can think that current local clock is accurate clock, clockwork can be replaced the clock information in the PTP sync message by current local clock information.
2) if adopt Peer_Delay mechanism, what in the PTP sync message, carry is local clock information and the deferred message of root node, and wherein, deferred message comprises transmission delay from root node to this clockwork and postpones in the delay of this clockwork.Because the path that receives this PTP sync message from the slave port is not optimal path, therefore need to utilize the clock of optimal path to be revised the clock information carried in the PTP sync message.On the deferred message basis of carrying in the PTP sync message, adding that C1 is outside the transmission delay between C3 and the delay of the delay on C3, also need to add a precision adjusted value, this precision adjusted value is the timing differential value (Δ between this transmission path and optimal transmission paths offset), Δ wherein offset=Offset best-Offset slave, wherein, Offset bestfor the local clock by current optimal path computation and the deviate between accurate clock, current optimal path is the path that port blocked is corresponding in the present embodiment; Offset slavefor the local clock by the calculating of slave port and the deviate between accurate clock.
From then on, after, C3 also only can utilize the jumping figure of local record and clock information to be upgraded the PTP sync message received from the P1 port.
By above-mentioned two situations, can find out, after using the present invention, C3 has selected more preferably path when carrying out clock synchronous, 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, by path C2-C1-C3, need the accumulation through twice ± 1 nanosecond, by path C2-C3, only the precision of once ± 1 nanosecond, obviously, can improve the precision of clock synchronous by method of the present invention.
Be more than the detailed description that method provided by the present invention is carried out, below clockwork provided by the present invention be described in detail.The structural representation that Fig. 7 is clockwork provided by the present invention, as shown in Figure 7, this clockwork can comprise: packet sending and receiving unit 701, jumping figure acquiring unit 702, path comparison unit 703, the first amending unit 704 and the second amending unit 705.
Packet sending and receiving unit 701, after by slave port or port blocked, receiving the PTP sync message, offer jumping figure acquiring unit 702 by this PTP sync message; The PTP sync message provided by master port repeat the first amending unit 704 or the second amending unit 705.
Jumping figure acquiring unit 702, for obtaining the jumping figure of the synchronous spanning-tree root node of clockwork distance P TP from the PTP sync message.
Path comparison unit 703, for jumping figure that jumping figure acquiring unit 702 is obtained and the jumping figure of local record, compare, if the jumping figure obtained is less than or equal to the jumping figure of record, determine that the slave port or path corresponding to port blocked that receive this PTP sync message are that current optimal path sends and revises notice to the first amending unit 704; Otherwise send and revise notice to the second amending unit 705.。
The first amending unit 704, after receiving the correction notice, utilize the clock information carried in described PTP sync message to be revised local clock, the jumping figure obtained if described is less than the jumping figure of record, further utilizes the described jumping figure obtained 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, utilize current local clock information to be revised the clock information carried in the PTP sync message, and, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP message is offered to described packet sending and receiving unit; Otherwise abandon the PTP sync message.
The second amending unit 705, after receiving the correction notice, if the PTP sync message receives by the slave port, and there is the master port in clockwork, utilize current local clock information to be revised the clock information carried in the PTP sync message, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP message is offered to 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 configured on 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 comparison unit 703, the first amending unit 704 and the second amending unit 705.
Now, packet sending and receiving unit 701, after receiving the PTP sync message, offer software processing module 710 according to the ACL list item by the PTP sync message.
Particularly, the mode that the 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 accurate clock, local clock is added to 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.
In the first 704 pairs of amending units PTP sync message, the correcting mode of clock information is: if adopt the time synchronizing method of Req_Resp mechanism, receive will be current while revising notice local clock replacement PTP sync message in clock information.If adopt the time synchronizing method of Peer_Delay mechanism, deferred message in the clock information the PTP sync message carried adds that transmission delay and PTP sync message that the slave port connects between upper hop clockwork and this clockwork postpone in the delay of this clockwork, the deferred message in the clock information that resulting value replacement PTP sync message is carried.
In the second 705 pairs of amending units PTP sync message, the correcting mode of clock information is: if adopt the time synchronizing method of Req_Resp mechanism, receive will be current while 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 the PTP sync message carried adds that the slave port connects transmission delay between upper hop clockwork and this clockwork, PTP sync message delay delay and the precision adjusted value Δ at this clockwork offset, the deferred message in the clock information that resulting value replacement PTP sync message is carried; Δ wherein offset=Offset best-Offset slave, Offset bestfor the local clock by current optimal path computation and the deviate between accurate clock, Offset slavefor the local clock by the calculating of slave port and the deviate between accurate clock.
Above-mentioned PTP sync message can or follow the Follow_Up message closely for time synchronized Sync message.
By above description, can be found out, the present invention has cancelled the restriction of port blocked for the PTP sync message, according to the PTP sync message come from the optimal path transmission, local clock is revised, and the PTP sync message be by the slave port, receive and this clockwork while having the master port, after the clock information carried in the PTP message is revised, by this PTP sync message of master port repeat so that subsequent clock equipment can carry out exact time synchronization.The correction of in the present invention, local clock being carried out is the PTP sync message that the optimal path transmission definite according to jumping figure information comes, and due to the jumping figure minimum of approach, its error accumulation brought is also minimum, thereby has improved the precision of time synchronized.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.

Claims (8)

1. the method for a time synchronized, is characterized in that, clockwork, by from slave port or port blocked receive precision clock agreement PTP sync message, is carried out following steps:
A, obtain the jumping figure of the synchronous spanning-tree root node of distance P TP from described PTP sync message;
The jumping figure of B, the jumping figure that steps A is obtained and local record compares, if the jumping figure obtained is less than or equal to the jumping figure of record, and execution step C; Otherwise execution step E;
C, determine that described slave port or path corresponding to port blocked are current optimal path, utilize the clock information carried in described PTP sync message to be revised local clock, if the jumping figure obtained described is less than the jumping figure of record, further utilizes jumping figure that steps A obtains to upgrade 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, utilize current local clock information to be revised the clock information carried in described PTP sync message, and after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat, process ends; 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 utilizing current local clock information to be revised the clock information carried in described PTP sync message and upgrading the jumping figure of the synchronous spanning tree node of the distance P TP carried in the PTP sync message, by this PTP sync message of master port repeat; Otherwise abandon described PTP sync message;
Wherein, in step D, utilize current local clock information to be revised specifically and comprise the clock information carried in described PTP sync message:
If adopt the time synchronizing method of request-reply Req_Resp mechanism, current local clock is replaced to the clock information in the PTP sync message; If adopt end to postpone the time synchronizing method of Peer_Delay mechanism, deferred message in the clock information described PTP sync message carried adds that the above slave port connects transmission delay between upper hop clockwork and this clockwork and described PTP sync message postpones in the delay of this clockwork, and resulting value is replaced to the deferred message in the clock information that described PTP sync message carries;
In step e, utilize current local clock information to be revised specifically and comprise the clock information carried in described PTP sync message:
If adopt the time synchronizing method of request-reply Req_Resp mechanism, current local clock is replaced to the clock information in the PTP sync message; If the time synchronizing method that adopts end to postpone Peer_Delay mechanism, the deferred message in the clock information described PTP sync message carried adds the above slave port and connects the transmission delay between upper hop clockwork and this clockwork, described PTP sync message delay delay and the precision adjusted value Δ at this clockwork offset, resulting value is replaced to the deferred message in the clock information that described PTP sync message carries; Δ wherein offset=Offset best-Offset slave, Offset bestfor the local clock by current optimal path computation and the deviate between accurate clock, Offset slavefor the local clock by described slave port calculating and the deviate between accurate clock.
2. method according to claim 1, it is characterized in that, the default reserved address of the unified employing of the target MAC (Media Access Control) address of described PTP sync message, the ACL list item that comprises described reserved address configured on described clockwork points to the software processing module of described clockwork, by described software processing module, executes claims each step described in 1.
3. method according to claim 1, it is characterized in that, if described PTP sync message receives by the slave port, in step C, utilize the clock information carried in described PTP sync message to be revised specifically and comprise local clock: to utilize the clock information carried in described PTP sync message to calculate the local clock of described clockwork and the deviate between accurate clock, described local clock is added to value that the deviate that calculates obtains is as revised local clock.
4. according to the described method of the arbitrary claim of claims 1 to 3, it is characterized in that, described PTP sync message is time synchronized Sync message or follows the Follow_Up message closely.
5. a clockwork, is characterized in that, this clockwork comprises: packet sending and receiving unit and jumping figure acquiring unit, path comparison unit, the first amending unit and the second amending unit;
Described packet sending and receiving unit, after by slave port or port blocked, receiving the PTP sync message, offer described jumping figure acquiring unit by this PTP sync message; The PTP sync message provided by described the first amending unit of master port repeat or the second amending unit;
Described jumping figure acquiring unit, for obtaining the jumping figure of the synchronous spanning-tree root node of described clockwork distance P TP from described PTP sync message;
Described path comparison unit, for jumping figure that described jumping figure acquiring unit is obtained and the jumping figure of local record, compare, if the jumping figure obtained is less than or equal to the jumping figure of record, determine that described slave port or path corresponding to port blocked are current optimal path, to described the first amending unit, send and revise notice; Otherwise send and revise notice to described the second amending unit;
Described the first amending unit, after receiving the correction notice, utilize the clock information carried in described PTP sync message to be revised local clock, the jumping figure obtained if described is less than the jumping figure of record, further utilizes the described jumping figure obtained 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, utilize current local clock information to be revised the clock information carried in described PTP sync message, and, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP sync message is offered to described packet sending and receiving unit; Otherwise abandon the PTP sync message;
Described the second amending unit, after receiving the correction notice, if described PTP sync message receives by the slave port, and there is the master port in described clockwork, utilize current local clock information to be revised the clock information carried in described PTP sync message, after upgrading the jumping figure of the synchronous spanning tree node of distance P TP carried in the PTP sync message, this PTP sync message is offered to described packet sending and receiving unit; Otherwise abandon the PTP sync message;
Wherein, in described the first amending unit, utilize current local clock information to be revised the clock information carried in described PTP sync message, if be specially the time synchronizing method that adopts Req_Resp mechanism, current local clock is replaced to 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 that the above slave port connects transmission delay between upper hop clockwork and this clockwork and described PTP sync message postpones in the delay of this clockwork, and resulting value is replaced to the deferred message in the clock information that described PTP sync message carries;
In the second amending unit, utilize current local clock information to be revised the clock information carried in described PTP sync message, if be specially the time synchronizing method that adopts Req_Resp mechanism, receive will be current while 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 upper hop clockwork and this clockwork, described PTP sync message delay delay and the precision adjusted value Δ at this clockwork offset, resulting value is replaced to the deferred message in the clock information that described PTP sync message carries; Δ wherein offset=Offset best-Offset slave, Offset bestfor the local clock by current optimal path computation and the deviate between accurate clock, Offset slavefor the local clock by the calculating of slave port and the deviate between accurate clock.
6. clockwork according to claim 5, it is characterized in that, unified default reserved address, the software processing module that the ACL list item that comprises described reserved address configured on described clockwork sensing comprises described jumping figure acquiring unit, path comparison unit, the first amending unit and the second amending unit of adopting of the target MAC (Media Access Control) address of described PTP sync message;
Described packet sending and receiving unit, after receiving described PTP sync message, offer described software processing module according to described ACL list item by described PTP sync message.
7. clockwork according to claim 5, it is characterized in that, described the first amending unit, specifically utilize the clock information carried in described PTP sync message to calculate the local clock of described clockwork and the deviate between accurate clock, described local clock is added to value that the deviate that calculates obtains is as revised local clock.
8. according to the described method of the arbitrary claim of claim 5 to 7, 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 CN102195766A (en) 2011-09-21
CN102195766B true 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)

Families Citing this family (14)

* 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
WO2013075307A1 (en) * 2011-11-24 2013-05-30 华为技术有限公司 Method, device and system for monitoring output time of network node
WO2014041592A1 (en) * 2012-09-11 2014-03-20 三菱電機株式会社 Correction parameter calculation device and system, correction parameter calculation method, and computer program
CN103312429B (en) * 2013-06-08 2015-11-25 杭州华三通信技术有限公司 A kind of method for synchronizing time and device
WO2015089848A1 (en) * 2013-12-20 2015-06-25 华为技术有限公司 Precision time protocol synchronization method and node
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
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
CN106936610B (en) * 2015-12-30 2020-01-24 中国移动通信集团公司 Network synchronization control method and device
CN106506260A (en) * 2016-10-17 2017-03-15 国电南瑞科技股份有限公司 A kind of message time delay measurement and modification method based on HSR bidirectional loop networks
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 (3)

* 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
CN101616163A (en) * 2009-07-27 2009-12-30 中兴通讯股份有限公司 Precise time transfer protocol message processing method and device

Family Cites Families (1)

* 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

Patent Citations (3)

* 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
CN101616163A (en) * 2009-07-27 2009-12-30 中兴通讯股份有限公司 Precise time transfer protocol message processing method and device

Also Published As

Publication number Publication date
CN102195766A (en) 2011-09-21

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
US8995473B2 (en) Ring based precise time data network clock phase adjustments
US9577774B2 (en) Time synchronization method and system
EP2541815B1 (en) Clock synchronization network
US9548833B2 (en) Method, apparatus and system for time distribution in a telecommunications network
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
EP3140932A1 (en) A method for robust ptp synchronization with default 1588v2 profile
JP2012209791A (en) Network node, time synchronization method, and network system
CN103428086B (en) The passive port electoral machinery of transparent clock based on PTP protocol and device
JP7401656B2 (en) METHODS, APPARATUS AND SYSTEM AND STORAGE MEDIA FOR SELECTING CLOCK SOURCES
CN113037417B (en) Method, device and storage medium for realizing one-step mode of precision time protocol message
CN102457346A (en) Time synchronization realizing method and clock node
WO2013178148A1 (en) Clock synchronization method and device for communication network
CN102195996B (en) Time synchronization method for stacking system, stacking system and member equipment
CN104836654B (en) A kind of clock synchronizing method based on Ethernet POWERLINK
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
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
CN112865907B (en) Method, device and storage medium for realizing precise time protocol delay request message
CN104185268A (en) Time slot synchronization algorithm suitable for self-organization networking
CN108462548B (en) Time synchronization method and device
US20180270005A1 (en) Wireless communications device, computer readable medium storing program, and method

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