A clock synchronization method and a clock synchronization system
By recording the path information of the transparent clock TC during PTP message transmission, the offset and jitter problems caused by inconsistent clock synchronization paths in the PTP protocol are solved, and high-precision clock synchronization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-04-07
AI Technical Summary
When using the High Precision Time Protocol (PTP) for clock synchronization, clock offsets and jitter can occur due to different optimal paths being selected during multiple PTP message transmissions.
By recording the path information of the transparent clock TC during PTP message transmission and updating the target message in a preset field, the consistency of the transmission path is ensured, thereby achieving clock synchronization.
It achieves the consideration of transmission path consistency during clock synchronization, avoids clock skew and jitter, and improves the accuracy of clock synchronization.
Smart Images

Figure CN115549840B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a clock synchronization method and clock synchronization system. Background Technology
[0002] In communication fields involving information exchange, such as power, navigation, monitoring, aerospace, and industrial control, high-precision clock synchronization technology is required to ensure the consistency of time standards during information transmission.
[0003] In existing technologies, the Precision Time Protocol (PTP) is typically used to determine the most accurate clock through an optimal master clock algorithm. However, when using two PTP ports to perform multiple PTP message transmissions for clock synchronization, clock offsets may occur due to the different optimal paths selected in the multiple PTP message transmissions. Summary of the Invention
[0004] This invention provides a clock synchronization method and a clock synchronization system to solve the problem of clock skew when using the PTP protocol for clock synchronization.
[0005] According to one aspect of the present invention, a clock synchronization method is provided, the method comprising:
[0006] The first PTP terminal sends a first PTP message to the second PTP terminal through a first transmission path consisting of at least one transparent clock TC.
[0007] During the transmission of the first PTP message, when the TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in the preset field of the first PTP message, generates a first target message, and sends the first target message to the second PTP end.
[0008] The first PTP terminal sends a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC.
[0009] During the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in the preset field of the second PTP message, generates a second target message, and sends the second target message to the second PTP end.
[0010] The second PTP terminal determines whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0011] If so, the second PTP terminal performs clock synchronization based on the first target message and the second target message.
[0012] According to another aspect of the present invention, a clock synchronization method is provided, performed by a transparent clock TC, the method comprising:
[0013] When the first PTP message is detected to pass by, the first TC path information is updated in the preset field of the first PTP message, a first target message is generated, and the first target message is sent to the second PTP terminal.
[0014] When the second PTP message is detected to pass by, the second TC path information is updated in the preset field of the second PTP message, a second target message is generated, and the second target message is sent to the second PTP terminal so that the second PTP terminal can synchronize its clock according to the first target message and the second target message.
[0015] According to another aspect of the present invention, a clock synchronization method is provided, executed by a second PTP terminal, the method comprising:
[0016] A first target message generated by the first PTP terminal is obtained and transmitted via a first transmission path consisting of at least one transparent clock (TC); wherein the first target message includes a first PTP message and first TC path information updated and generated when the first PTP message passes through the first transmission path during transmission.
[0017] A second target message generated by the first PTP terminal being transmitted via a second transmission path consisting of at least one TC is obtained; wherein the second target message includes a second PTP message and second TC path information updated and generated when the second PTP message passes through the second transmission path during transmission.
[0018] Based on the first TC path information in the first target message and the second TC path information in the second target message, determine whether the first transmission path and the second transmission path are consistent.
[0019] If so, clock synchronization is performed based on the first target message and the second target message.
[0020] According to another aspect of the present invention, a clock synchronization device is provided, performed by a transparent clock TC, the device comprising:
[0021] The first target message sending module is used to update the first TC path information in a preset field of the first PTP message when the first PTP message is detected to pass by, generate the first target message, and send the first target message to the second PTP terminal.
[0022] The second target message sending module is used to update the second TC path information in a preset field of the second PTP message when the second PTP message is detected to pass by, generate a second target message, and send the second target message to the second PTP end so that the second PTP end can perform clock synchronization according to the first target message and the second target message.
[0023] According to another aspect of the present invention, a clock synchronization device is provided, executed by a second PTP terminal, the device comprising:
[0024] The first target message acquisition module is used to acquire a first target message generated by the first PTP terminal through a first transmission path composed of at least one transparent clock TC; wherein the first target message includes a first PTP message and first TC path information updated and generated when the first PTP message passes through the first transmission path during transmission.
[0025] The second target message acquisition module is used to acquire a second target message generated by the first PTP terminal through a second transmission path composed of at least one TC; wherein the second target message includes a second PTP message and second TC path information updated and generated when the second PTP message passes through the second transmission path during transmission.
[0026] The transmission path consistency determination module is used to determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0027] The clock synchronization module is used to perform clock synchronization based on the first target message and the second target message if the first transmission path is consistent with the second transmission path.
[0028] According to another aspect of the present invention, a clock synchronization system is provided, the system comprising a first PTP terminal, at least one transparent clock TC, and a second PTP terminal; wherein:
[0029] The first PTP terminal is used to send a first PTP message to the second PTP terminal through a first transmission path consisting of at least one transparent clock TC.
[0030] The TC in the first transmission path is used to update the first TC path information in a preset field of the first PTP message when the first PTP message is detected to pass through during the transmission of the first PTP message, generate a first target message, and send the first target message to the second PTP end.
[0031] The first PTP terminal is used to send a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC.
[0032] The TC in the second transmission path is used to update the second TC path information in a preset field of the second PTP message when the second PTP message is detected to pass through during the transmission of the second PTP message, generate a second target message, and send the second target message to the second PTP end.
[0033] The second PTP terminal is used to determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0034] The second PTP terminal is used to perform clock synchronization based on the first target message and the second target message if the first transmission path and the second transmission path are the same.
[0035] The technical solution of this invention synchronizes the clock between the first PTP end and the second PTP end. When transmitting the first PTP message and the second PTP message, the TC (Transmission Control Point) status of each PTP message is recorded. This allows for determination of whether the transmission paths of the first and second PTP messages are consistent based on the TC status during transmission. If the transmission paths are consistent, clock synchronization can be performed between the first and second PTP ends. Since each PTP message requires a certain amount of time (residual time) to pass through each TC, the technical solution of this invention can detect the consistency of the PTP message transmission paths and perform clock synchronization when the transmission paths are consistent. This avoids clock skew caused by different optimal paths selected for PTP message transmission, i.e., different TCs. The technical solution of this invention solves the problem of clock skew when using the PTP protocol for clock synchronization, achieving the effect of considering the consistency of the transmission path during clock synchronization, thereby avoiding clock jitter.
[0036] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1a This is a flowchart of a clock synchronization method provided according to Embodiment 1 of the present invention;
[0039] Figure 1b This is a clock synchronization flowchart provided based on existing technology;
[0040] Figure 1c This is a schematic diagram of a grid-like topology for a transmission path;
[0041] Figure 1d This is a schematic diagram of a ring topology for a transmission path;
[0042] Figure 2 This is a flowchart of a clock synchronization method provided according to Embodiment 2 of the present invention;
[0043] Figure 3 This is a flowchart of a clock synchronization method provided according to Embodiment 3 of the present invention;
[0044] Figure 4 This is a schematic diagram of a clock synchronization device provided in Embodiment 4 of the present invention;
[0045] Figure 5 This is a schematic diagram of a clock synchronization device provided in Embodiment 5 of the present invention;
[0046] Figure 6 This is a schematic diagram of a clock synchronization system provided in Embodiment Six of the present invention;
[0047] Figure 7 This is a schematic diagram of the structure of an electronic device that implements the clock synchronization method of this invention. Detailed Implementation
[0048] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0049] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0050] Example 1
[0051] Figure 1a This is a flowchart of a clock synchronization method according to Embodiment 1 of the present invention. This embodiment is applicable to clock synchronization using the PTP protocol. When using two PTP ports for clock synchronization, the consistency of the transmission path can be considered to improve the accuracy of clock synchronization.
[0052] Before introducing the specific solutions of the embodiments of the present invention, the basic knowledge of clock synchronization using the PTP protocol will be explained first.
[0053] Specifically, Figure 1b This is a clock synchronization flowchart based on existing technology. For example... Figure 1b As shown, the master PTP (Master Clock time) can embed timestamp t1 into a Sync message and send it to the slave PTP (Slave Clock time); alternatively, the master can embed timestamp t1 into a Follow_Up message and send it to the slave. Here, t1 is the time the master sends the Sync message. The slave receives the Sync message at time t2 and sends a delay request (Delay_Req) to the master at time t3; the master receives the Delay_Req at time t4 and sends a Delay response (Delay_Resp) message embedded in t4 to the slave. The slave can calculate the average propagation time based on t1, t2, t3, and t4, i.e., (t... ms +t sm ) / 2, and then determine the clock difference based on the average propagation time for clock synchronization.
[0054] However, when using a two-step PTP port for clock synchronization, the transmission paths traversed by the Sync message and the Follow_Up message may differ. This transmission path consists of one or more transparent clocks (TCs). The Sync message can correspond one-to-one with the Follow_Up message. The Follow_Up message can record an accurate t1 value; when transmitting the Follow_Up message, the residence time recorded by each TC in the transmission path is written into the Follow_Up message to enable clock synchronization on the slave. When the Sync message and the Follow_Up message traverse different transmission paths, the residence time in the Follow_Up message will not be the actual residence time of the corresponding Sync message in the transmission path, resulting in jitter in the slave's clock synchronization.
[0055] For example, Figure 1c This is a schematic diagram of a grid-like topology for a transmission path. Figure 1d This is a schematic diagram of a ring topology for a transmission path. Figure 1c In the context of the Sync message, the transmission path is A->B->C; the corresponding Follow_Up message transmission path is A->D->E->F->C. Figure 1d In the code, the Sync message follows a transmission path of A->B->C; the corresponding Follow_Up message follows a transmission path of D->E->F. The transmission paths of the Sync and Follow_Up messages cannot be detected in current technology. When the transmission paths of the two messages are inconsistent, clock synchronization on the Slave side will experience jitter.
[0056] The clock synchronization method provided in this embodiment of the invention can detect the transmission path traversed by the Sync message and the Follow_Up message, thereby avoiding jitter in the clock synchronization of the Slave.
[0057] like Figure 1a As shown, the clock synchronization method includes:
[0058] Step 110: The first PTP terminal sends a first PTP message to the second PTP terminal through a first transmission path consisting of at least one TC.
[0059] The first PTP port can be either an ordinal clock or a boundary clock in a two-step PTP setup. Specifically, the first PTP port can be either a master PTP instance or a slave PTP instance. Similarly, the second PTP port can also be either an ordinal clock or a master PTP instance. The first and second PTP ports synchronize their clocks by sending PTP messages. These PTP messages can be PTP timing messages, such as Sync, Follow_Up, Delay_Req, or Delay_Resp messages.
[0060] For example, the first PTP endpoint is a Master PTP Instance, and the second PTP endpoint is a Slave PTP Instance. The first PTP endpoint can send a first PTP message to the second PTP endpoint through a first transmission path consisting of one or more TCs. The first PTP message can be a Sync message. During the transmission of the Sync message, the TCs in the first transmission path can record the dwell time of the Sync message within that TC.
[0061] Step 120: During the transmission of the first PTP message, when the TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in the preset field of the first PTP message, generates the first target message, and sends the first target message to the second PTP end.
[0062] The preset fields in the first PTP message can be newly added fields within the first PTP message; alternatively, they can be reserved fields (RSVD) in the first PTP message. In practical applications, the length of the TC path information can be considered when selecting the preset fields. The TC path information can represent the TCs traversed by the PTP message in the transmission path. For example, the TC path information can represent the number of TCs and / or the types of TCs traversed by the PTP message in the transmission path. The target information can include both the PTP message and the TC path information. Specifically, the first target message can include the Sync message and the first TC path information.
[0063] Step 130: The first PTP terminal sends a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC.
[0064] The second PTP message can be a Follow_Up message. During the transmission of the Follow_Up message, the TC in the second transmission path can write the recorded residence time of the Sync message in that TC into the Follow_Up message.
[0065] Step 140: During the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in the preset field of the second PTP message, generates the second target message, and sends the second target message to the second PTP end.
[0066] The second target message may include a Follow_Up message and second TC path information.
[0067] Step 150: The second PTP terminal determines whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0068] When the first TC path information is the same as the second TC path information, it can be determined that the first transmission path and the second transmission path are consistent.
[0069] Step 160: If the first transmission path is consistent with the second transmission path, the second PTP terminal performs clock synchronization based on the first target message and the second target message.
[0070] Specifically, when the first transmission path and the second transmission path are detected to be consistent, the dwell time recorded in the second PTP message is the actual dwell time of the corresponding first PTP message during transmission. This allows for clock synchronization based on the first and second target messages, avoiding data jitter and reducing clock deviation. When the first and second transmission paths are detected to be inconsistent, the second PTP end can discard both the first and second target messages.
[0071] Specifically, the first target message and the second target message are sent periodically. The technical solution of this invention allows for the retention of only the first target message and the second target message corresponding to the same transmission path, and clock synchronization based on this can avoid clock jitter caused by inconsistent transmission paths.
[0072] For example, the process of clock synchronization by the second PTP end based on the first target message and the second target message can be as follows: when the second PTP end detects that the transmission path is consistent, the second PTP end records the reception time t2 of the first target message, extracts the transmission time t1 of the first target message and the dwell time t5 in the transmission of the first target message from the second target message; based on t1... ’=t2-t5–(t ms +t sm ) / 2, from which we can deduce t1 ’ According to Δt=t1 ’ -t1 allows us to obtain the clock difference Δt, which can then be used for clock synchronization. Where (t ms +t sm ) / 2 can be obtained in several ways. For example, (t) ms +t sm The average transmission time (t) / 2 can be obtained using existing techniques to determine the average transmission time, i.e., by calculating it using t1, t2, t3, and t4. ms +t sm ) / 2.
[0073] In this embodiment of the invention, in order to improve (t) ms +t sm The accuracy of t / 2 can be obtained by calculating from t1, t2, t3, t4 and the residence time (t ms +t sm ) / 2.
[0074] Specifically, in an optional embodiment of the present invention, the second PTP terminal performs clock synchronization based on the first target message and the second target message, including: the second PTP terminal sending a third PTP message to the first PTP terminal through a third transmission path composed of at least one TC; during the transmission of the third PTP message, when a TC in the third transmission path detects the passage of the third PTP message, it updates the third TC path information in a preset field of the third PTP message, generates a third target message, and sends the third target message to the first PTP terminal; the first PTP terminal generates a fourth PTP message based on the third target message, and sends it to the second PTP terminal through a fourth transmission path composed of at least one TC. The PTP terminal sends a fourth PTP message, which includes the third TC path information. During the transmission of the fourth PTP message, when the TC in the fourth transmission path detects the passage of the fourth PTP message, it updates the fourth TC path information in a preset field of the fourth PTP message, generates a fourth target message, and sends the fourth target message to the second PTP terminal. The second PTP terminal determines whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information. If they are consistent, the second PTP terminal performs clock synchronization based on the first target message, the second target message, the third target message, and the fourth target message.
[0075] The third PTP message can be a Delay_Req message, and the fourth PTP message can be a Delay_Resp message. The fourth PTP message may also include the third TC path information from the third target message. The third target message may include the Delay_Req message and the third TC path information. The fourth target message may include the Delay_Resp message, the third TC path information, and the fourth TC path information; or, the fourth target message may include the Delay_Resp message and the fourth TC path information.
[0076] Specifically, the update method for the third TC path information can be the same as that for the first or second TC path information. There can be multiple methods for updating the fourth TC path information.
[0077] In an optional embodiment of the present invention, updating the fourth TC path information in a preset field of the fourth PTP message includes: adding fourth TC path information to the preset field of the fourth PTP message; or, changing the third TC path information in the preset field of the fourth PTP message as the fourth TC path information.
[0078] Specifically, the fourth TC path information can be updated by adding fourth TC path information to the existing third TC path information. When adding fourth TC path information, the update method is the same as that for the first, second, or third TC path information. Alternatively, the fourth TC path information can be updated by modifying the third TC path information. For example, the first, second, or third TC path information can be generated by adding TC path information to the transmission path; the fourth path information can be generated by reducing TC path information in the transmission path. Specifically, the first, second, or third TC path information can be generated by increasing the number of TCs and / or increasing the number of TC types in the transmission path. The fourth TC path information can be generated by reducing the number of TCs and / or reducing the number of TC types in the transmission path.
[0079] Accordingly, the second PTP terminal determines whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information. This includes: when the second PTP terminal detects that the third TC path information and the fourth TC path information are consistent, it determines that the third transmission path and the fourth transmission path are consistent; or, when the second PTP terminal detects that the fourth TC path information is 0, it determines that the third transmission path and the fourth transmission path are consistent.
[0080] When the fourth TC path information update method is the same as the third TC path information update method, the second PTP end can determine the consistency of the transmission path by detecting whether the third TC path information and the fourth TC path information are consistent. When the fourth TC path information update method is inconsistent with the third TC path information update method, the second PTP end can determine the consistency of the transmission path by detecting whether the fourth TC path information is 0.
[0081] In an optional embodiment of the present invention, during the transmission of the first PTP message, when a TC in the first transmission path detects that the first PTP message has passed, the first TC path information is updated in a preset field of the first PTP message, including: during the transmission of the first PTP message, when a TC in the first transmission path detects that the first PTP message has passed, the number of TCs traversed in the first transmission path is updated in a preset field of the first PTP message.
[0082] The number of TCs can be updated in preset fields of the PTP message. For example, 8 bits can be reserved in the PTP message to update the number of TCs; or, an additional 8 bits can be added to the PTP message to update the number of TCs. Specifically, the default number of TCs in the PTP message is 0. When the PTP message passes through a TC, the number of TCs can be incremented by 1 in the preset field.
[0083] Accordingly, in an optional embodiment of the present invention, during the transmission of the second PTP message, when a TC in the second transmission path detects that the second PTP message has passed, the second TC path information is updated in a preset field of the second PTP message, including: during the transmission of the second PTP message, when a TC in the second transmission path detects that the second PTP message has passed, the number of TCs traversed in the second transmission path is updated in a preset field of the second PTP message.
[0084] The update methods for the third and second TC path information can be similar to those for the first TC path information, i.e., each time a TC is passed, the TC can increment the number of TCs in the PTP message by 1. The update method for the fourth TC path information can be similar to that for the third TC path information; or, the update method for the fourth TC path information can be that each time a TC is passed, the TC can decrement the number of TCs in the PTP message by 1.
[0085] Based on the above embodiments, optionally, during the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, the first TC path information is updated in a preset field of the first PTP message, including: during the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, the clock identification information of the TC that passes through the first transmission path is updated in a preset field of the first PTP message.
[0086] The clock identifier information of the TC can be updated in the preset fields of the PTP message. For example, 24 bits can be reserved in the PTP message to update the TC's clock identifier information; or, a new 24-bit field can be added to the PTP message to update the TC's clock identifier information. Specifically, the default clock identifier information of the TC in the PTP message can be 0. When the PTP message passes through a TC, the TC's clock identifier information can be updated in the preset fields. There are several ways to update the TC's clock identifier information, such as recording the clock identifier information of all TCs that have passed through, or performing logical operations on the clock identifier information of the TCs that have passed through.
[0087] Specifically, the clock identification information can be an Extended Unique Identifier (EUI) of a preset length or an Extended Local Identifier (ELI). EUI and ELI indicate that the TC is unique. Specifically, the TC model can be EUI-48, ELI-48, or ELI-64. Furthermore, the TC's clock identification information can be the last 24 bits of the EUI or ELI.
[0088] Furthermore, in an optional embodiment of the present invention, during the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, the clock identification information of the TCs passed through in the first transmission path is updated in a preset field of the first PTP message, including: during the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, performing a logical operation based on the clock identification information updated by the TCs that have already passed and the clock identification information of the TCs that are currently passing through; and updating the clock identification information of the TCs passed through in the first transmission path in a preset field of the first PTP message according to the result of the logical operation.
[0089] The logical operation can be an accumulation operation or an XOR operation, etc. Specifically, the clock identifier information of the TC in the PTP message can initially be 0. When the PTP message passes through a TC, the TC can perform an accumulation operation on the last 24 bits of its own clock identifier information and the existing TC clock identifier information in the PTP message to update the TC clock identifier information in the preset field of the PTP message.
[0090] Optionally, when overflow of the result of a logical operation is detected, a wrapping process is performed to obtain the result of the logical operation. The wrapping process can be understood as recounting the result of the logical operation.
[0091] Accordingly, in an optional embodiment of the present invention, during the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, the second TC path information is updated in a preset field of the second PTP message, including: during the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, the clock identification information of the TC that passes through in the second transmission path is updated in a preset field of the second PTP message.
[0092] Accordingly, in an optional embodiment of the present invention, during the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, the clock identification information of the TCs passed through in the second transmission path is updated in a preset field of the second PTP message. This includes: during the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, performing a logical operation based on the clock identification information updated by the TCs that have already passed through and the clock identification information of the TCs that are currently passing through; and updating the clock identification information of the TCs passed through in the second transmission path in a preset field of the second PTP message according to the result of the logical operation.
[0093] It should be noted that the update methods for the third and second TC path information can be similar to those for the first TC path information. That is, after each TC passes through, the TC can accumulate or XOR the clock identifier information of the TC in the PTP message. The update method for the fourth TC path information can be similar to that for the third TC path information; or, the update method for the fourth TC path information can be that after each TC passes through, the TC can perform a step-by-step subtraction or XOR operation on the clock identifier information of the TC in the PTP message.
[0094] Furthermore, in an optional embodiment of the present invention, the second PTP terminal determines whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message. This includes: when the second PTP terminal detects that the number information and clock identification information contained in the first TC path information are the same as the number information and clock identification information contained in the second TC path information, it determines that the first transmission path and the second transmission path are consistent; otherwise, it determines that the first transmission path and the second transmission path are inconsistent.
[0095] In an optional embodiment of the present invention, when the second PTP terminal detects that the third TC path information is consistent with the fourth TC path information, determining that the third transmission path is consistent with the fourth transmission path includes: when the second PTP terminal detects that the number information and clock identification information contained in the third TC path information are consistent with the number information and clock identification information contained in the fourth TC path information, determining that the third transmission path is consistent with the fourth transmission path.
[0096] When it is determined that the first transmission path is consistent with the second transmission path, and the third transmission path is consistent with the fourth transmission path, the result (t) can be calculated using t1, t2, t3, t4, and the dwell time. ms +t sm ) / 2, thus the second PTP terminal can achieve clock synchronization with the first PTP terminal.
[0097] For example, (t) is calculated using t1, t2, t3, t4, and the residence time. ms +t sm The formula for ) / 2 can be: (t) ms +t sm ) / 2=((t2-t1-t5)+(t4-t3-t6)) / 2. Where t6 is the dwell time of the third PTP message from the second PTP end to the first PTP end via the TC. The dwell time can be recorded in the fourth PTP message. When the fourth transmission path is the same as the third transmission path, the dwell time recorded in the fourth PTP message is the dwell time corresponding to the transmission of the third PTP message. Thus, (t) / 2 is determined. ms +t sm The accuracy of ) / 2 is higher, and the precision of clock synchronization is greater. This can avoid the unreliability of the determined dwell time when the transmission path is inconsistent, which can cause clock jitter.
[0098] In this embodiment, the first PTP terminal sends a first PTP message to the second PTP terminal through a first transmission path composed of at least one transparent clock (TC). During the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in a preset field of the first PTP message, generates a first target message, and sends the first target message to the second PTP terminal. The first PTP terminal then sends a second PTP message to the second PTP terminal through a second transmission path composed of at least one TC. During the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in a preset field of the second PTP message, generates a second target message, and sends the second target message to the second PTP terminal. The second PTP terminal determines whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message. If they are consistent, the second PTP terminal performs clock synchronization based on the first target message and the second target message. This solves the problem of clock skew when using the PTP protocol for clock synchronization, ensuring that the transmission path meets consistency during clock synchronization, thereby avoiding clock jitter.
[0099] A specific usage process of this invention embodiment can be as follows: At time t1, the Master sends a Sync message to the Slave through at least one TC; in the Sync message, the number of TCs is initially 0, and the clock identifier of the TCs is initially 0; when the Sync message passes through the current TC, the current TC can increment the number of TCs in the Sync message by 1, and then add the last 24 bits of the current TC's clock identifier to the TC's clock identifier; the Slave receives the Sync message at time t2. The Master sends a Follow_up message to the Slave through at least one TC; in the Follow_up message, the number of TCs is initially 0, and the clock identifier of the TCs is initially 0; when the Follow_up message passes through the current TC, the current TC can increment the number of TCs in the Follow_up message by 1, and then add the last 24 bits of the current TC's clock identifier to the TC's clock identifier; the Slave receives the Follow_up message. The Follow_up message records the accurate time value t1. When the Follow_up message passes through a TC, the TC can write the locally stored dwell time into the Follow_up message. The Slave can determine whether the transmission paths traversed by the Sync message and the Follow_up message are consistent based on the number of TCs and / or the clock identifier information of the TCs in the Sync message and the Follow_up message. When the transmission paths traversed by the Sync message and the Follow_up message are consistent, the dwell time written into the Follow_up message is the cumulative dwell time t5 of the Sync message when it passes through each TC in the transmission path.
[0100] At time t3, the Slave sends a Delay_Req message to the Master through at least one TC. In the Delay_Req message, the number of TCs is initially 0, and the clock identifier of the TC is initially 0. When the Delay_Req message passes through the current TC, the current TC can increment the number of TCs in the Delay_Req message by 1, and then add the last 24 bits of the current TC's clock identifier to the TC's clock identifier. The Master receives the Delay_Req message at time t4. The Master sends a Delay_Resp message to the Slave via at least one Terminal Clock (TC). In the Delay_Resp message, the initial number of TCs is the same as the final number of TCs in the Delay_Req message. The initial clock identifier of each TC in the Delay_Resp message is also the same as the final clock identifier of the TCs in the Delay_Req message. When the Delay_Resp message passes through a current TC, the current TC decrements the number of TCs by 1 and subtracts the last 24 bits of its clock identifier. The Slave receives the Delay_Resp message. The Delay_Resp message records the accurate t4 time value. When the Delay_Resp message passes through a TC, the TC can write its locally stored delay time into the Delay_Resp message. The Slave can determine whether the Delay_Req message and the Delay_Resp message follow the same transmission path based on the number of TCs and / or the clock identifier of the TCs in the Delay_Resp message. When the Delay_Req message and the Delay_Resp message follow the same transmission path, the dwell time written into the Delay_Resp message is the cumulative dwell time t6 of the Delay_Req message when it passes through each TC in the transmission path.
[0101] Therefore, the Slave end can calculate (t) based on t1, t2, t3, t4, t5, and t6. ms +t sm ) / 2, and then according to t1 ’ =t2-t5–(t ms +t sm ) / 2 speculate t1 ’ According to Δt=t1 ’ -t1 can be used to obtain the clock difference Δt, and finally clock synchronization can be performed based on the clock difference.
[0102] The above messages can be sent periodically. When the transmission paths of the Sync message and Follow_up message are inconsistent, or when the transmission paths of the Delay_Req message and Delay_Resp message are inconsistent, the (t) calculated in the current iteration can be discarded. ms +t sm ) / 2; (t) calculated using the consistent transmission path. ms +t sm Using ) / 2 for clock synchronization ensures the reliability of the dwell time, avoids data jitter, and improves the accuracy of clock synchronization.
[0103] Example 2
[0104] Figure 2 This is a flowchart of a clock synchronization method according to Embodiment 2 of the present invention. The technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. This method can be executed by a TC in the transmission path. Figure 2 As shown, the method includes:
[0105] Step 210: When the first PTP message is detected to pass by, update the first TC path information in the preset field of the first PTP message, generate the first target message, and send the first target message to the second PTP terminal.
[0106] Step 220: When the second PTP message is detected to pass by, update the second TC path information in the preset field of the second PTP message, generate the second target message, and send the second target message to the second PTP end so that the second PTP end can synchronize its clock according to the first target message and the second target message.
[0107] In an optional embodiment of the present invention, when the first PTP message is detected to have passed, the first TC path information is updated in a preset field of the first PTP message, including: when the first PTP message is detected to have passed, the number of TCs traversed in the first transmission path is updated in a preset field of the first PTP message.
[0108] Accordingly, in an optional embodiment of the present invention, when the second PTP message is detected to have passed, the second TC path information is updated in a preset field of the second PTP message, including: when the second PTP message is detected to have passed, the number of TCs traversed in the second transmission path is updated in a preset field of the second PTP message.
[0109] Based on the above implementation, optionally, when the first PTP message is detected to have passed, the first TC path information is updated in a preset field of the first PTP message, including: when the first PTP message is detected to have passed, the clock identification information of the TC passed through in the first transmission path is updated in a preset field of the first PTP message.
[0110] Accordingly, in an optional embodiment of the present invention, when the second PTP message is detected to have passed, the second TC path information is updated in a preset field of the second PTP message, including: when the second PTP message is detected to have passed, the clock identification information of the TC passed through in the second transmission path is updated in a preset field of the second PTP message.
[0111] In an optional embodiment of the present invention, when the first PTP message is detected to have passed, the clock identification information of the TC passed through in the first transmission path is updated in a preset field of the first PTP message, including: when the first PTP message is detected to have passed, performing a logical operation based on the clock identification information updated by the TC that has already passed and the clock identification information of the TC that is currently passed; and updating the clock identification information of the TC passed through in the first transmission path in a preset field of the first PTP message based on the result of the logical operation.
[0112] Accordingly, in an optional embodiment of the present invention, when the second PTP message is detected to have passed, the clock identification information of the TC passed through in the second transmission path is updated in a preset field of the second PTP message, including: when the second PTP message is detected to have passed, performing a logical operation based on the clock identification information updated by the TC that has already passed and the clock identification information of the TC that is currently passed; and updating the clock identification information of the TC passed through in the second transmission path in a preset field of the second PTP message based on the result of the logical operation.
[0113] In an optional embodiment of the present invention, the clock identification information is an extended unique identifier of a preset length or an extended local identifier.
[0114] In an optional embodiment of the present invention, after performing logical operations based on the clock identifier information updated by TC and the clock identifier information currently processed by TC, the method further includes: when overflow of the result generated by the logical operation is detected, performing wrap processing to obtain the result of the logical operation.
[0115] In an optional embodiment of the present invention, the method further includes: when a third PTP message is detected passing by, updating the third TC path information in a preset field of the third PTP message, generating a third target message, and sending the third target message to the first PTP end; when a fourth PTP message is detected passing by, updating the fourth TC path information in a preset field of the fourth PTP message, generating a fourth target message, and sending the fourth target message to the second PTP end.
[0116] In an optional embodiment of the present invention, updating the fourth TC path information in a preset field of the fourth PTP message includes: adding fourth TC path information to the preset field of the fourth PTP message; or, changing the third TC path information in the preset field of the fourth PTP message as the fourth TC path information.
[0117] The technical solution of this invention, when detecting the passage of a first PTP message, updates the first TC path information in a preset field of the first PTP message, generates a first target message, and sends the first target message to the second PTP end; when detecting the passage of a second PTP message, updates the second TC path information in a preset field of the second PTP message, generates a second target message, and sends the second target message to the second PTP end, so that the second PTP end can perform clock synchronization based on the first target message and the second target message. This solves the problem of clock skew when using the PTP protocol for clock synchronization, and can ensure that the transmission path meets the consistency during clock synchronization, thereby avoiding the effect of clock jitter.
[0118] Example 3
[0119] Figure 3 This is a flowchart of a clock synchronization method according to Embodiment 3 of the present invention. The technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. This method can be executed by a second PTP terminal. Figure 3 As shown, the method includes:
[0120] Step 310: Obtain the first target message generated by the first PTP terminal through the first transmission path formed by at least one transparent clock TC.
[0121] The first target message includes a first PTP message and first TC path information updated and generated when the first PTP message passes through the first transmission path during transmission.
[0122] Step 320: Obtain the second target message generated by the first PTP end through the second transmission path composed of at least one TC.
[0123] The second target message includes a second PTP message and second TC path information updated and generated when the second PTP message passes through the second transmission path during transmission.
[0124] Step 330: Determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0125] In an optional embodiment of the present invention, determining whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message includes: if the number information and clock identification information contained in the first TC path information are the same as the number information and clock identification information contained in the second TC path information, then the first transmission path and the second transmission path are consistent; otherwise, the first transmission path and the second transmission path are inconsistent.
[0126] Step 340: If the first transmission path is consistent with the second transmission path, then perform clock synchronization based on the first target message and the second target message.
[0127] In an optional embodiment of the present invention, the method further includes: sending a third PTP message to a first PTP terminal through a third transmission path composed of at least one TC; obtaining a fourth target message generated by the first PTP terminal and sent to a second PTP terminal through a fourth transmission path composed of at least one TC; determining whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information; if so, performing clock synchronization based on the first target message, the second target message, the third target message, and the fourth target message.
[0128] The first PTP endpoint can obtain a third target message generated by the second PTP endpoint via a third transmission path consisting of at least one TC; the third target message includes a third PTP message and third TC path information. The first PTP endpoint generates a fourth PTP message based on the third target message and sends the fourth PTP message to the second PTP endpoint via a fourth transmission path consisting of at least one TC; the fourth PTP message includes the third TC path information. The fourth target message includes both the fourth PTP message and the fourth TC path information.
[0129] In an optional embodiment of the present invention, determining whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information, includes: determining that the third transmission path and the fourth transmission path are consistent when the third TC path information and the fourth TC path information are detected to be consistent; or determining that the third transmission path and the fourth transmission path are consistent when the fourth TC path information is detected to be 0.
[0130] The technical solution of this invention involves obtaining a first target message generated by a first PTP terminal transmitted via a first transmission path composed of at least one transparent clock (TC); obtaining a second target message generated by a first PTP terminal transmitted via a second transmission path composed of at least one TC; determining whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message; and if the first transmission path and the second transmission path are consistent, performing clock synchronization based on the first target message and the second target message. This solves the problem of clock skew when using the PTP protocol for clock synchronization, ensuring that the transmission path meets consistency during clock synchronization, thereby avoiding clock jitter.
[0131] Example 4
[0132] Figure 4 This is a schematic diagram of a clock synchronization device provided in Embodiment 4 of the present invention. Figure 4 As shown, the device includes: a first target message sending module 410 and a second target message sending module 420. Wherein:
[0133] The first target message sending module 410 is used to update the first TC path information in the preset field of the first PTP message when the first PTP message is detected to pass by, generate the first target message, and send the first target message to the second PTP end.
[0134] The second target message sending module 420 is used to update the second TC path information in the preset field of the second PTP message when the second PTP message is detected to pass by, generate the second target message, and send the second target message to the second PTP end so that the second PTP end can synchronize its clock according to the first target message and the second target message.
[0135] Optionally, the first target message sending module 410 includes: a first data information update unit, used to update the number of TCs passed through in the first transmission path in a preset field of the first PTP message when the first PTP message is detected to have passed.
[0136] Optionally, the second target message sending module 420 includes: a second data information update unit, used to update the number of TCs passed through in the second transmission path in a preset field of the second PTP message when the second PTP message is detected to have passed.
[0137] Optionally, the first target message sending module 410 includes: a first clock identification information updating unit, used to update the clock identification information of the TC passed through in the first transmission path in a preset field of the first PTP message when the first PTP message is detected to have passed.
[0138] Optionally, the second target message sending module 420 includes: a second clock identification information updating unit, used to update the clock identification information of the TC passed through in the second transmission path in a preset field of the second PTP message when the second PTP message is detected to have passed.
[0139] Optionally, the first clock identifier information update unit is specifically used for: when the first PTP message is detected to have passed, performing logical operations based on the clock identifier information that has been updated by the TC and the clock identifier information of the TC that has passed through the current TC; and updating the clock identifier information of the TC that has passed through the first transmission path in a preset field of the first PTP message according to the result of the logical operation.
[0140] Optionally, the second clock identifier information update unit is specifically used for: when the second PTP message is detected to have passed, performing logical operations based on the clock identifier information that has been updated by the TC and the clock identifier information of the TC that has passed through the current TC; and updating the clock identifier information of the TC that has passed through the second transmission path in a preset field of the second PTP message according to the result of the logical operation.
[0141] Optionally, the clock identification information can be an extended unique identifier of a preset length or an extended local identifier.
[0142] Optionally, the device may also include:
[0143] The third target message sending module is used to update the third TC path information in the preset field of the third PTP message when the third PTP message is detected to pass by, generate the third target message, and send the third target message to the first PTP end.
[0144] The fourth target message sending module is used to update the fourth TC path information in the preset field of the fourth PTP message when the fourth PTP message is detected to pass by, generate the fourth target message, and send the fourth target message to the second PTP end.
[0145] Optionally, the fourth target message sending module is specifically used to: add fourth TC path information to the preset fields of the fourth PTP message; or, change the third TC path information in the preset fields of the fourth PTP message as the fourth TC path information.
[0146] The clock synchronization device provided in the embodiments of the present invention can execute the clock synchronization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0147] Example 5
[0148] Figure 5 This is a schematic diagram of a clock synchronization device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device includes: a first target message acquisition module 510, a second target message acquisition module 520, a transmission path consistency determination module 530, and a clock synchronization module 540. Wherein:
[0149] The first target message acquisition module 510 is used to acquire a first target message generated by the first PTP terminal through a first transmission path composed of at least one transparent clock TC; wherein the first target message includes a first PTP message and first TC path information updated and generated when the first PTP message passes through the first transmission path during transmission.
[0150] The second target message acquisition module 520 is used to acquire a second target message generated by the first PTP terminal through a second transmission path composed of at least one TC; wherein the second target message includes a second PTP message, and second TC path information updated and generated when the second PTP message passes through the second transmission path during transmission.
[0151] The transmission path consistency determination module 530 is used to determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0152] The clock synchronization module 540 is used to perform clock synchronization based on the first target message and the second target message if the first transmission path is consistent with the second transmission path.
[0153] Optionally, the transmission path consistency determination module 530 includes:
[0154] The transmission path consistency determination unit is used to determine that the first transmission path and the second transmission path are consistent when the number information and clock identification information contained in the first TC path information are the same as those contained in the second TC path information; otherwise, it is determined that the first transmission path and the second transmission path are inconsistent.
[0155] Optionally, the device may also include:
[0156] The third PTP message sending module is used to send a third PTP message to the first PTP end through a third transmission path consisting of at least one TC;
[0157] The fourth target message acquisition module is used to acquire the fourth target message generated by the first PTP terminal and sent to the second PTP terminal through the fourth transmission path consisting of at least one TC.
[0158] Another transmission path consistency determination module is used to determine whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information.
[0159] Another clock synchronization module is used to perform clock synchronization based on the first target message, the second target message, the third target message, and the fourth target message if the third transmission path is consistent with the fourth transmission path.
[0160] Optionally, another transmission path consistency determination module, specifically used for:
[0161] When the third TC path information is detected to be consistent with the fourth TC path information, it is determined that the third transmission path is consistent with the fourth transmission path; or, when the fourth TC path information is detected to be 0, it is determined that the third transmission path is consistent with the fourth transmission path.
[0162] The clock synchronization device provided in the embodiments of the present invention can execute the clock synchronization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0163] Example 6
[0164] Figure 6 This is a schematic diagram of a clock synchronization system provided in Embodiment Six of the present invention. Figure 6 As shown, the system includes: a first PTP terminal, at least one TC, and a second PTP terminal. The first PTP terminal is used to send a first PTP message to the second PTP terminal through a first transmission path consisting of at least one TC.
[0165] The TC in the first transmission path is used to update the first TC path information in the preset field of the first PTP message when the first PTP message is detected to pass through during the transmission of the first PTP message, generate the first target message, and send the first target message to the second PTP end.
[0166] The first PTP terminal is used to send a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC.
[0167] The TC in the second transmission path is used to update the second TC path information in the preset field of the second PTP message when the second PTP message is detected to pass through during the transmission of the second PTP message, generate the second target message, and send the second target message to the second PTP end.
[0168] The second PTP terminal is used to determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message.
[0169] The second PTP terminal is used to perform clock synchronization based on the first target message and the second target message if the first transmission path and the second transmission path are the same.
[0170] Optionally, the TC in the first transmission path is specifically used to: when the first PTP message is detected to pass through, update the number of TCs passed through in the first transmission path in a preset field of the first PTP message;
[0171] The TC in the second transmission path is specifically used to: when the second PTP message is detected to have passed through, update the number of TCs that have passed through the second transmission path in the preset field of the second PTP message.
[0172] Optionally, the TC in the first transmission path is specifically used to: when the first PTP message is detected to pass through, update the clock identification information of the TC that passes through in the first transmission path in a preset field of the first PTP message;
[0173] The TC in the second transmission path is specifically used to: when the second PTP message is detected to pass through, update the clock identification information of the TC that has passed through the second transmission path in the preset field of the second PTP message.
[0174] Optionally, the TC in the first transmission path is specifically used for: when the first PTP message is detected to pass by, performing logical operations based on the clock identifier information updated by the TC and the clock identifier information of the currently passed TC; and updating the clock identifier information of the TC passed by in the first transmission path in a preset field of the first PTP message based on the result of the logical operation.
[0175] The TC in the second transmission path is specifically used for: when the second PTP message is detected to pass by, performing logical operations based on the clock identifier information updated by the TC and the clock identifier information of the currently passing TC; and updating the clock identifier information of the TC passed by in the second transmission path in the preset field of the second PTP message according to the result of the logical operation.
[0176] Optionally, the clock identification information can be an extended unique identifier of a preset length or an extended local identifier.
[0177] Optionally, the second PTP end is also used to send a third PTP message to the first PTP end through a third transmission path consisting of at least one TC;
[0178] The TC in the third transmission path is used to detect when the third PTP message passes by, update the third TC path information in the preset field of the third PTP message, generate the third target message, and send the third target message to the first PTP end;
[0179] The first PTP terminal is also used to generate a fourth PTP message based on the third target message, and send the fourth PTP message to the second PTP terminal through a fourth transmission path consisting of at least one TC; wherein the fourth PTP message includes the third TC path information;
[0180] The TC in the fourth transmission path is used to detect the passage of the fourth PTP message, update the fourth TC path information in the preset field of the fourth PTP message, generate the fourth target message, and send the fourth target message to the second PTP end.
[0181] The second PTP terminal is also used to determine whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information.
[0182] The second PTP terminal is specifically used to perform clock synchronization based on the first target message, the second target message, the third target message, and the fourth target message if the third transmission path is consistent with the fourth transmission path.
[0183] The technical solution of this invention involves the interactive transmission of various PTP messages by a first PTP terminal, at least one TC, and a second PTP terminal; the second PTP terminal detects whether the transmission paths of the paired PTP messages are consistent; when the transmission paths are consistent, the second PTP terminal performs clock synchronization based on each superPTP message, which solves the problem of clock skew when using the PTP protocol for clock synchronization, and realizes the effect of considering the consistency of the transmission path during clock synchronization, thereby avoiding clock jitter.
[0184] Example 7
[0185] Figure 7A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0186] like Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0187] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0188] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as clock synchronization methods.
[0189] In some embodiments, the clock synchronization method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the clock synchronization method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the clock synchronization method by any other suitable means (e.g., by means of firmware).
[0190] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0191] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0192] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0193] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0194] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0195] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0196] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0197] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A clock synchronization method, characterized in that, include: The first PTP terminal sends a first PTP message to the second PTP terminal through a first transmission path consisting of at least one transparent clock TC. During the transmission of the first PTP message, when the TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in the preset field of the first PTP message, generates a first target message, and sends the first target message to the second PTP end. The first PTP terminal sends a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC. During the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in the preset field of the second PTP message, generates a second target message, and sends the second target message to the second PTP end. The second PTP terminal determines whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message. If so, the second PTP terminal performs clock synchronization based on the first target message and the second target message.
2. The method according to claim 1, characterized in that, During the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in a preset field of the first PTP message, including: During the transmission of the first PTP message, when a TC in the first transmission path detects that the first PTP message has passed by, the number of TCs that have passed through the first transmission path is updated in a preset field of the first PTP message. Accordingly, during the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in a preset field of the second PTP message, including: During the transmission of the second PTP message, when a TC in the second transmission path detects that the second PTP message has passed by, the number of TCs that have passed through the second transmission path is updated in a preset field of the second PTP message.
3. The method according to claim 2, characterized in that, During the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, it updates the first TC path information in a preset field of the first PTP message, including: During the transmission of the first PTP message, when a TC in the first transmission path detects that the first PTP message has passed by, the clock identification information of the TC that has passed through the first transmission path is updated in a preset field of the first PTP message. Accordingly, during the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it updates the second TC path information in a preset field of the second PTP message, including: During the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, it updates the clock identification information of the TC that has passed through the second transmission path in the preset field of the second PTP message.
4. The method according to claim 3, characterized in that, During the transmission of the first PTP message, when a TC in the first transmission path detects the passage of the first PTP message, it updates the clock identification information of the TCs traversed in the first transmission path in a preset field of the first PTP message, including: During the transmission of the first PTP message, when the TC in the first transmission path detects the passage of the first PTP message, it performs logical operations based on the clock identifier information that has been updated by the TC and the clock identifier information of the TC that has passed through. Based on the result of the logical operation, the clock identification information of the TC traversed in the first transmission path is updated in the preset field of the first PTP message; Accordingly, during the transmission of the second PTP message, when a TC in the second transmission path detects the passage of the second PTP message, it updates the clock identification information of the TCs traversed in the second transmission path in a preset field of the second PTP message, including: During the transmission of the second PTP message, when the TC in the second transmission path detects the passage of the second PTP message, it performs logical operations based on the clock identifier information that has been updated by the TC and the clock identifier information of the TC that has passed through. Based on the result of the logical operation, the clock identification information of the TC traversed in the second transmission path is updated in the preset field of the second PTP message.
5. The method according to claim 4, characterized in that, The clock identification information is an extended unique identifier of a preset length or an extended local identifier.
6. The method according to claim 1, characterized in that, The second PTP terminal performs clock synchronization based on the first target message and the second target message, including: The second PTP endpoint sends a third PTP message to the first PTP endpoint through a third transmission path consisting of at least one TC. During the transmission of the third PTP message, when the TC in the third transmission path detects the passage of the third PTP message, it updates the third TC path information in the preset field of the third PTP message, generates a third target message, and sends the third target message to the first PTP end. The first PTP terminal generates a fourth PTP message based on the third target message and sends the fourth PTP message to the second PTP terminal through a fourth transmission path consisting of at least one TC; wherein, the fourth PTP message includes the third TC path information; During the transmission of the fourth PTP message, when the TC in the fourth transmission path detects the passage of the fourth PTP message, it updates the fourth TC path information in the preset field of the fourth PTP message, generates the fourth target message, and sends the fourth target message to the second PTP end. The second PTP terminal determines whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information. If so, the second PTP terminal performs clock synchronization based on the first target message, the second target message, the third target message, and the fourth target message.
7. The method according to claim 6, updating the fourth TC path information in a preset field of the fourth PTP message, comprising: Add fourth TC path information to the preset fields of the fourth PTP message; Alternatively, the third TC path information can be changed in a preset field of the fourth PTP message and used as the fourth TC path information; Accordingly, the second PTP end determines whether the third transmission path and the fourth transmission path are consistent based on the third TC path information and the fourth TC path information, or based on the fourth TC path information, including: When the second PTP terminal detects that the third TC path information is consistent with the fourth TC path information, it determines that the third transmission path is consistent with the fourth transmission path. or, When the second PTP terminal detects that the fourth TC path information is 0, it determines that the third transmission path is consistent with the fourth transmission path.
8. A clock synchronization method, executed by a transparent clock TC, characterized in that, include: When the first PTP message is detected to pass by, the first TC path information is updated in the preset field of the first PTP message, a first target message is generated, and the first target message is sent to the second PTP terminal. When the second PTP message is detected, the second TC path information is updated in the preset field of the second PTP message, a second target message is generated, and the second target message is sent to the second PTP end, so that the second PTP end can determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message; if the first transmission path and the second transmission path are consistent, clock synchronization is performed based on the first target message and the second target message.
9. A clock synchronization method, executed by a second PTP terminal, characterized in that, include: A first target message generated by the first PTP terminal is obtained and transmitted via a first transmission path consisting of at least one transparent clock (TC); wherein the first target message includes a first PTP message and first TC path information updated and generated when the first PTP message passes through the first transmission path during transmission. A second target message generated by the first PTP terminal being transmitted via a second transmission path consisting of at least one TC is obtained; wherein the second target message includes a second PTP message and second TC path information updated and generated when the second PTP message passes through the second transmission path during transmission. Based on the first TC path information in the first target message and the second TC path information in the second target message, determine whether the first transmission path and the second transmission path are consistent. If so, clock synchronization is performed based on the first target message and the second target message.
10. A clock synchronization system, characterized in that, The system includes a first PTP terminal, at least one transparent clock TC, and a second PTP terminal; wherein: The first PTP terminal is used to send a first PTP message to the second PTP terminal through a first transmission path consisting of at least one transparent clock TC. The TC in the first transmission path is used to update the first TC path information in a preset field of the first PTP message when the first PTP message is detected to pass through during the transmission of the first PTP message, generate a first target message, and send the first target message to the second PTP end. The first PTP terminal is used to send a second PTP message to the second PTP terminal through a second transmission path consisting of at least one TC. The TC in the second transmission path is used to update the second TC path information in a preset field of the second PTP message when the second PTP message is detected to pass through during the transmission of the second PTP message, generate a second target message, and send the second target message to the second PTP end. The second PTP terminal is used to determine whether the first transmission path and the second transmission path are consistent based on the first TC path information in the first target message and the second TC path information in the second target message. The second PTP terminal is used to perform clock synchronization based on the first target message and the second target message if the first transmission path and the second transmission path are the same.
Citation Information
Patent Citations
Time synchronization method and clock device
CN102195766A
Test method based on network measurement and control system time synchronous protocol in power industry
CN103051487A