Time synchronization method and apparatus, electronic device, storage medium, and computer program product

By utilizing intermediate nodes to interact with upper-layer nodes in the data center network to determine port latency and update time data in synchronization messages, the client can quickly synchronize time, solving the problem of high resource consumption in existing technologies and improving network performance.

WO2026158287A1PCT designated stage Publication Date: 2026-07-30CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CHINA MOBILE COMM LTD RES INST
Filing Date
2026-01-20
Publication Date
2026-07-30

AI Technical Summary

Technical Problem

Existing time synchronization methods struggle to flexibly distinguish and process terminals requiring synchronization in large-scale data center networks, resulting in high resource consumption and reduced network performance.

Method used

By receiving synchronization messages from the time server, intermediate nodes interact with upper-layer nodes to determine port latency and update time data in the synchronization messages. Clients perform time synchronization based on the received timestamps, reducing multiple interactions with the time server.

Benefits of technology

It improved network processing performance, reduced network resource consumption, and achieved rapid time synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026073645_30072026_PF_FP_ABST
    Figure CN2026073645_30072026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of network time synchronization, and provides a time synchronization method and apparatus, an electronic device, a storage medium, and a computer program product. The method comprises: receiving a synchronization packet sent by a time server, wherein the synchronization packet comprises time data, and the time data is used for characterizing a delay in a communication path; and performing time synchronization on the basis of the time data and a receiving timestamp for the synchronization packet. The solution in embodiments of the present disclosure can improve network performance.
Need to check novelty before this filing date? Find Prior Art

Description

Time synchronization methods, devices, electronic equipment, storage media, and computer program products

[0001] Cross-references to related applications

[0002] This disclosure claims priority to Chinese Patent Application No. 202510110270.6, filed in China on January 23, 2025, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This disclosure relates to the field of network time synchronization technology, and in particular to a time synchronization method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0004] With the continuous development of technology, the demand for high-precision synchronization services such as network time synchronization is increasing daily. The amount of data and the scale of parameters used in basic large-scale models are growing exponentially, and the scale of distributed intelligent computing clusters is constantly expanding. Compared with traditional network time synchronization, data center network time synchronization is particularly large in scale and highly scalable. A data center may have tens of thousands or even hundreds of thousands of cards, all of which may need time synchronization. Current time synchronization methods require a master time server to initiate synchronization, cascading downstream. If some terminals in the network need time synchronization while others do not, it is difficult to flexibly distinguish and handle this. This time synchronization method requires the entire network to support it, consumes a lot of resources, and reduces network performance. Summary of the Invention

[0005] The present disclosure provides a time synchronization method, apparatus, electronic device, storage medium, and computer program product that can improve network processing performance.

[0006] The technical solution disclosed herein is implemented as follows:

[0007] This disclosure provides a time synchronization method, including:

[0008] The system receives a synchronization message sent by a time server; wherein the synchronization message includes time data; the time data is used to characterize the latency in the communication path.

[0009] Time synchronization is performed based on the time data and the received timestamp of the synchronization message.

[0010] In the above scheme, before receiving the synchronization message sent by the time server, the method further includes:

[0011] The intermediate node interacts with the corresponding upper-level node to determine the first port delay between the intermediate node and the corresponding upper-level node.

[0012] In the above scheme, the intermediate node interacts with the corresponding upper-layer node to determine the first port delay between itself and the corresponding upper-layer node, including:

[0013] The intermediate node sends a first message to the upper-layer node; wherein the first message corresponds to a first sending timestamp;

[0014] The upper-layer node receives the first message and determines the first reception timestamp of the first message;

[0015] The upper-layer node periodically sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message;

[0016] The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the second message.

[0017] In the above scheme, before receiving the synchronization message sent by the time server, the method further includes:

[0018] Send a synchronization request to the time server.

[0019] The method in the above scheme further includes:

[0020] The intermediate node receives the synchronization request sent by the lower-level node, forwards the synchronization request to the upper-level node without processing it, and so on, until it is sent to the server.

[0021] The method in the above scheme further includes:

[0022] The time server responds to the synchronization request by sending the synchronization message to the client through various intermediate nodes; wherein the synchronization message includes a sending timestamp.

[0023] The method in the above scheme further includes:

[0024] The intermediate node receives the synchronization message sent by the upper-layer node;

[0025] The intermediate node adds the first port delay update to the sending timestamp in the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0026] The method in the above scheme further includes:

[0027] The intermediate node receives the synchronization message sent by the upper-layer node;

[0028] The intermediate node adds the first port delay update to the second port delay in the predetermined field of the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay updated in the predetermined field by the node before the intermediate node.

[0029] In the above scheme, the time synchronization based on the time data and the received timestamp of the synchronization message includes:

[0030] A first time deviation is determined based on the sending timestamp, the third port delay, and the receiving timestamp; wherein, the third port delay is the delay between the client and the previous intermediate node;

[0031] The system clock is adjusted based on the first time deviation to achieve time synchronization.

[0032] In the above scheme, determining the first time deviation based on the sending timestamp, the third port delay, and the receiving timestamp includes:

[0033] The first time deviation is determined based on the difference between the sum of the sending timestamp and the third port delay and the receiving timestamp.

[0034] In the above scheme, the time synchronization based on the time data and the received timestamp of the synchronization message includes:

[0035] The second time deviation is determined based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp;

[0036] The system clock is adjusted based on the second time deviation to achieve time synchronization.

[0037] In the above scheme, determining the second time deviation based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp includes:

[0038] The second time deviation is determined based on the difference between the sum of the sending timestamp, the second port delay, and the third port delay, and the receiving timestamp.

[0039] This disclosure also provides a time synchronization method applied to intermediate nodes, including:

[0040] Forward the synchronization message sent by the upper-layer node to the lower-layer node; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

[0041] In the above scheme, before forwarding the synchronization message sent by the upper-layer node to the lower-layer node, the method further includes:

[0042] The system receives synchronization requests from lower-level nodes, forwards them to upper-level nodes without processing, and continues this process until the request is sent to the server.

[0043] In the above scheme, forwarding the synchronization message sent by the upper-layer node to the lower-layer node includes:

[0044] Receive the synchronization message sent by the upper-layer node;

[0045] The first port delay update is added to the sending timestamp in the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0046] In the above scheme, forwarding the synchronization message sent by the upper-layer node to the lower-layer node includes:

[0047] Receive the synchronization message sent by the upper-layer node;

[0048] The first port delay update is added to the second port delay in the predetermined field of the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay of the node before the intermediate node after updating in the predetermined field.

[0049] The method in the above scheme further includes:

[0050] Interact with the corresponding upper-layer node to determine the first port delay between the upper-layer node and the corresponding upper-layer node.

[0051] The method in the above scheme further includes:

[0052] Store the delay of the first port corresponding to the upper-layer node.

[0053] In the above scheme, the periodic interaction with the corresponding upper-layer node to determine the first port delay between the upper-layer node and the corresponding upper-layer node includes:

[0054] Send a delayed first message to the upper-layer node; wherein the first message corresponds to a first sending timestamp;

[0055] The upper-layer node receives the first message and determines the first reception timestamp of the first message;

[0056] The upper-layer node sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message;

[0057] The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the delayed response message.

[0058] This disclosure also provides a time synchronization method applied to a time server, including:

[0059] Send a synchronization message to the client so that the client can perform time synchronization;

[0060] The synchronization message includes time data, which is used to characterize the latency in the communication path.

[0061] In the above scheme, before sending the synchronization message back to the client, the method further includes:

[0062] Receive synchronization requests sent by the client.

[0063] In the above scheme, sending a synchronization message to the client includes:

[0064] In response to the synchronization request, the synchronization message is sent to the client through each intermediate node; wherein the synchronization message includes a sending timestamp.

[0065] This disclosure also provides a time synchronization device for use on a client, including:

[0066] The first receiving unit is configured to receive a synchronization message sent by a time server; wherein the synchronization message includes time data; the time data is used to characterize the latency in the communication path;

[0067] The time synchronization unit is used to perform time synchronization based on the time data and the received timestamp of the synchronization message.

[0068] This disclosure also provides a time synchronization device applied to an intermediate node, comprising:

[0069] A forwarding unit is used to forward synchronization messages sent by upper-layer nodes to lower-layer nodes; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

[0070] This disclosure also provides a time synchronization device applied to a time server, comprising:

[0071] The second sending unit is used to send a synchronization message to the client for the client to perform time synchronization.

[0072] The synchronization message includes time data, which is used to characterize the latency in the communication path.

[0073] This disclosure also provides an electronic device, including a first memory and a first processor, wherein the first memory stores a computer program that can run on the first processor, and the first processor executes the computer program to implement the steps in a client-side method.

[0074] This disclosure also provides an electronic device, including a second memory and a second processor, the second memory storing a computer program executable on the second processor, the second processor executing the computer program to implement steps in a method on one side of an intermediate node.

[0075] This disclosure also provides an electronic device, including a third memory and a third processor, wherein the third memory stores a computer program that can run on the third processor, and the third processor executes the computer program to implement the steps in the method on the time server side.

[0076] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a first processor, implements the steps in the client-side method.

[0077] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a second processor, implements the steps in the method on one side of the intermediate node.

[0078] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a third processor, implements the steps of the method on the time server side.

[0079] This disclosure also provides a computer program product, including a computer program that, when executed by a first processor, implements the steps of a client-side method.

[0080] This disclosure also provides a computer program product, including a computer program that, when executed by a second processor, implements the steps of a method on one side of an intermediate node.

[0081] This disclosure also provides a computer program product, including a computer program that, when executed by a third processor, implements the steps of a method on the time server side.

[0082] In this embodiment, a synchronization message sent by a time server is received. The synchronization message includes time data, which characterizes the latency in the communication path. Time synchronization is performed based on the time data and the timestamp of the received synchronization message. Because the synchronization message includes the latency in the communication path, the client can quickly perform time synchronization after receiving the synchronization message. Compared to solutions in related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and thus improving network performance. Attached Figure Description

[0083] Figure 1 is a schematic diagram illustrating the effects of the related technologies provided in the embodiments of this disclosure;

[0084] Figure 2 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure;

[0085] Figure 3 is a schematic diagram illustrating the effect of the time synchronization method provided in the embodiments of this disclosure.

[0086] Figure 4 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0087] Figure 5 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure.

[0088] Figure 6 is a schematic diagram illustrating the effect of the time synchronization method provided in the embodiments of this disclosure.

[0089] Figure 7 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure;

[0090] Figure 8 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure.

[0091] Figure 9 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure;

[0092] Figure 10 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure;

[0093] Figure 11 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0094] Figure 12 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure.

[0095] Figure 13 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure;

[0096] Figure 14 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0097] Figure 15 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0098] Figure 16 is a flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0099] Figure 17 is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure.

[0100] Figure 18 is a flowchart of the time synchronization method provided in the embodiments of this disclosure, number fifteen;

[0101] Figure 19 is a schematic flowchart of the time synchronization method provided in the embodiments of this disclosure.

[0102] Figure 20 is an interactive schematic diagram of the time synchronization method provided in the embodiments of this disclosure;

[0103] Figure 21 is a schematic diagram of the time synchronization device provided in an embodiment of this disclosure.

[0104] Figure 22 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this disclosure.

[0105] Figure 23 is a schematic diagram of the time synchronization device provided in an embodiment of this disclosure;

[0106] Figure 24 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this disclosure;

[0107] Figure 25 is a schematic diagram of the time synchronization device provided in an embodiment of this disclosure.

[0108] Figure 26 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0109] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this disclosure. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0110] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0111] If the application documents contain similar descriptions such as "first / second", the following explanation shall be added: In the following description, the terms "first / second / third" are used only to distinguish similar objects and do not represent a specific order of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this disclosure described herein can be implemented in an order other than that illustrated or described herein.

[0112] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs. The terminology used herein is for the purpose of describing embodiments of this disclosure only and is not intended to be limiting of this disclosure.

[0113] In related technologies, with the continuous development of science and technology, the demand for high-precision synchronization services such as computing power network time synchronization is increasing day by day. The amount of data and the scale of parameters used by the basic large model are growing exponentially, and the scale of distributed intelligent computing clusters is constantly expanding. Compared with traditional network time synchronization, data center network time synchronization is particularly large in scale and highly scalable. A data center may have tens of thousands or hundreds of thousands of cards, all of which may be subject to time synchronization.

[0114] Existing high-precision time synchronization networks are primarily based on the Precision Time Protocol (PTP) method, which employs a master-slave time synchronization mechanism. In a PTP communication path, the master clock provides the source time for synchronization with the next-level clock, i.e., for reference by the slave clock. The slave clock then corrects its local time based on the time provided by the master clock by exchanging communication messages with it.

[0115] Referring to Figure 1, the following is the process and principle of PTP master and slave devices calculating path delay and time offset.

[0116] The master clock sends a synchronization message at time t1, and the Sync message contains the sending time t1.

[0117] Record the time t2 when the Sync message is received from the clock; then send a Delay Request (Delay_Req) ​​message at time t3.

[0118] The master clock records the time t4 when it receives the Delay_Req message, and then sends a delayed response (Delay_Resp) message, carrying the time t4 to inform the slave clock.

[0119] Assuming the link delay between the master and slave clocks is symmetrical, the slave clock can calculate the time deviation and link delay from the master clock based on the four known time values.

[0120] Assuming the slave clock leads the master clock by an offset, then: (t2-Offset)-t1 = Delay t4-(t3-Offset) = Delay

[0121] The time deviation between the slave clock and the master clock can be calculated as: Offset = [(t2-t1)+(t3-t4)] / 2

[0122] Link delay between slave clock and master clock: Delay = [(t2-t1)+(t4-t3)] / 2

[0123] Correcting local time from the clock, the value is the local time value minus the calculated offset value.

[0124] In related technologies, existing PTP technologies face the following problems when applied to new computing power networks:

[0125] 1. It requires a master time server to initiate synchronization, which is then passed down through all downstream terminals. If some terminals in the network need time synchronization while others do not, it is difficult to flexibly distinguish and handle this. Moreover, time synchronization initiated by the master time server requires the support of the entire network, posing significant challenges in terms of resources and processing capacity.

[0126] 2. When using the Boundary Clock (BC) method, intermediate nodes need to support system clock processing and phase-locked synchronization in hardware. For complex data center networks, hardware modification of intermediate nodes is quite difficult.

[0127] To address the aforementioned technical problems, this disclosure provides a time synchronization method. Please refer to Figure 2, which is a flowchart illustrating the time synchronization method provided in this disclosure. The steps shown in Figure 2 will be explained in conjunction with the following:

[0128] S101. Receive a synchronization message sent by a time server; wherein the synchronization message includes: time data; the time data is used to characterize the delay in the communication path.

[0129] In this embodiment, the client can first send a synchronization request to the time server. Upon receiving the synchronization request, the client receives a synchronization message from an intermediate node in the communication path. Each intermediate node, after receiving the synchronization message, can update the time data in the synchronization message using a pre-determined port delay with the upper-layer node and forward it to the next node until the synchronization message reaches the client. The time data is used to characterize the latency in the communication path.

[0130] In this embodiment, the data center network of the client and time server can be described with reference to Figure 3. As shown in Figure 3, the time server and client can be connected in a spine-leaf architecture, with spine switches connected to leaf switches and leaf switches connected to the client.

[0131] In this embodiment of the disclosure, each intermediate node in the communication path can pre-exchange messages with the upper-layer node to determine the port delay between the intermediate node and the upper-layer node.

[0132] S102. Based on the time data and the received timestamp of the synchronization message, perform time synchronization.

[0133] In this embodiment of the disclosure, the client determines the timeoffset based on time data and the received timestamp of the synchronization message, and adjusts the system clock according to the timeoffset to achieve synchronization with the time server.

[0134] In this embodiment, a synchronization message sent by a time server is received. The synchronization message includes time data, which characterizes the latency in the communication path. Time synchronization is performed based on the time data and the timestamp of the received synchronization message. Because the synchronization message includes the latency in the communication path, the client can quickly perform time synchronization after receiving the synchronization message. Compared to solutions in related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and thus improving network performance.

[0135] Please refer to Figure 4, which is a second flowchart illustrating the time synchronization method provided in this embodiment. The step S101 shown in Figure 2 may further include S201, which will be described in conjunction with the steps below:

[0136] S201. The intermediate node interacts with the corresponding upper-layer node to determine the first port delay between the intermediate node and the corresponding upper-layer node.

[0137] In this embodiment of the disclosure, the intermediate node interacts with the corresponding upper-layer node via message exchange (which may include periodic interaction) to determine the first port delay between the intermediate node and the corresponding upper-layer node.

[0138] For example, referring to Figure 3, each layer node obtains and records the first port delay between itself and the ports of its directly connected upper-layer nodes through message interaction. The correspondence between the first port delay data and the ports is recorded. For instance, in Figure 3, the leaf node records the delay values ​​of each port connected to the spine node, and the client records the delay values ​​of each port connected to the leaf node.

[0139] In this embodiment, the first port delay is determined by message interaction between intermediate nodes and the corresponding upper-layer nodes. Thus, as the synchronization message passes through each intermediate node, the intermediate node can update the time data in the synchronization message using the first port delay. Consequently, the client can quickly use the time data for time synchronization after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with a time server, reducing network resource consumption and improving network performance.

[0140] Please refer to Figure 5, which is a flowchart illustrating the time synchronization method provided in this embodiment. Step S201 shown in Figure 4 can also be implemented via steps S2011 to S2014, which will be explained in conjunction with the steps below:

[0141] S2011, The intermediate node periodically sends a first message to the upper-layer node.

[0142] In this embodiment of the disclosure, the intermediate node can periodically send a first message to the upper-layer node. The first message corresponds to a first transmission timestamp. The first message is used to determine the first port delay.

[0143] S2012, The upper-layer node receives the first message and determines the first reception timestamp of the first message.

[0144] In this embodiment of the disclosure, the upper-layer node receives the first message sent by the corresponding intermediate node and determines the first reception timestamp corresponding to the first message.

[0145] S2013, the upper-layer node sends a second message to the intermediate node; wherein, the second message includes: a second sending timestamp and a first receiving timestamp, or, the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message.

[0146] In this embodiment of the disclosure, the upper-layer node responds to the first message by sending a second message to the intermediate node. The second message includes: a second sending timestamp and the first receiving timestamp; or, the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message.

[0147] S2014. The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the second message.

[0148] In this embodiment of the disclosure, after receiving the second message, the intermediate node determines a time difference based on the second sending timestamp and the first receiving timestamp. The first port delay is determined by subtracting this time difference from the second receiving timestamp and the first sending timestamp.

[0149] In this embodiment, each layer node interacts with its directly connected upper-layer node via message exchange to obtain the first port delay between the ports of the upper-layer nodes directly connected to it, as shown in Figure 6. The lower-layer node sends a delay request message (first message) to the upper-layer node and records the first sending timestamp T1 of the message. T1 may or may not be included in the delay request message. After receiving the delay request message, the upper-layer node records the first receiving timestamp T2 of the message. The upper-layer node sends a delay response message (second message) to the lower-layer node. The second sending timestamp of this message is T3. The delay response message carries information of (T3-T2), which can be carried directly as the difference timestamp, or it can carry two timestamps, T3 and T2, etc. After receiving the delay response message, the lower-layer node records the second receiving timestamp T4 of the message. The lower-level node calculates the port delay between the lower-level node and the port of the upper-level node directly connected to it based on the information T1, T3-T2, and T4. It can be calculated according to the following formula: Delay = [T4 - (T3 - T2) - T1] / 2.

[0150] In this embodiment, the first port delay is determined by message interaction between intermediate nodes and the corresponding upper-layer nodes. Thus, as the synchronization message passes through each intermediate node, the intermediate node can update the time data in the synchronization message using the first port delay. Consequently, the client can quickly use the time data for time synchronization after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with a time server, reducing network resource consumption and improving network performance.

[0151] Please refer to Figure 7, which is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure. The steps will be described in conjunction with the following:

[0152] S301. Send a synchronization request to the time server.

[0153] In this embodiment of the disclosure, the client sends a synchronization request to the time server through an intermediate node in the network communication path. The synchronization request is used to request the time server to respond with a synchronization message so that the client can synchronize its time.

[0154] In this embodiment of the disclosure, the client sets the Internet Protocol (IP) address of the time server and sends a synchronization request to it. This request is routed to the time server via the IP address. Intermediate nodes between the client and the time server (e.g., spine switches, leaf switches, etc.) only forward the synchronization request and do not perform any other processing on the message content.

[0155] In this embodiment, a synchronization request is sent to a time server. Since the synchronization request is sent by the client to the time server, the entire time synchronization process is initiated by the client. Compared to related technologies where the time server simultaneously initiates synchronization to a large number of clients, this client-initiated approach consumes fewer resources and thus improves network performance.

[0156] Please refer to Figure 8, which is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure. The steps will be described in conjunction with the following:

[0157] S302. The intermediate node receives the synchronization request sent by the lower-level node, forwards the synchronization request to the upper-level node without processing it, until it is sent to the server.

[0158] In this embodiment of the disclosure, the client sends a synchronization request to the time server through various intermediate nodes in the communication path. Each intermediate node, after receiving the synchronization request sent by the lower-level node, forwards the synchronization request to the upper-level node without processing it, until it is sent to the server.

[0159] In this embodiment, intermediate nodes forward synchronization requests to upper-layer nodes without processing them, until the requests are sent to the server. This reduces the processing resource pressure on intermediate nodes, thereby improving network processing performance.

[0160] Please refer to Figure 9, which is a flowchart illustrating the time synchronization method provided in this embodiment of the present disclosure. The steps will be described in conjunction with the following:

[0161] S303. The time server responds to the synchronization request by sending the synchronization message to the client through each intermediate node; wherein the synchronization message includes a sending timestamp.

[0162] In this embodiment of the disclosure, the time server responds to a synchronization request by sending synchronization messages to the client through various intermediate nodes in the communication path. The synchronization message includes a timestamp indicating that the time server sent the synchronization request. Each intermediate node updates the time data within the synchronization message using the recorded first port delay during the forwarding process.

[0163] Please refer to Figure 10, which is a flowchart illustrating the time synchronization method provided in this embodiment. S303 in Figure 9 can also be implemented through S3031 to S3032, which will be explained in conjunction with the steps:

[0164] S3031, The intermediate node receives the synchronization message sent by the upper-layer node.

[0165] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the port of the upper-layer node.

[0166] S3032, The intermediate node adds the first port delay update to the sending timestamp in the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0167] In this embodiment of the disclosure, after each intermediate node receives the synchronization message sent by the upper-layer node, it can add the first port delay update between itself and the upper-layer node to the sending timestamp of the synchronization message to form a new sending timestamp, that is, to form new time data, and send the updated synchronization message to the next node until it is sent to the client.

[0168] In this embodiment, the intermediate node uses the first port delay to update the timestamp in the synchronization message to obtain the updated time data. This allows the client to quickly synchronize its time using the time data after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and improving network performance.

[0169] Please refer to Figure 11, which is a flowchart illustrating the time synchronization method provided in this embodiment. S303 in Figure 9 can also be implemented via S3033 to S3034, which will be explained in conjunction with the steps:

[0170] S3033, The intermediate node receives the synchronization message sent by the upper-layer node.

[0171] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the upper-layer node.

[0172] S3034. The intermediate node adds the first port delay update to the second port delay in the predetermined field of the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay updated in the predetermined field by the node before the intermediate node.

[0173] In this embodiment of the disclosure, after each intermediate node receives a synchronization message sent by an upper-layer node, it can add the first port delay update between itself and the upper-layer node to the second port delay in a preset field of the synchronization message to form a new port delay. The updated synchronization message is then determined and forwarded to the lower-layer node until it is sent to the client. The preset field is different from the sending timestamp field. The time data includes the sending timestamp and the second port delay in the preset field. The second port delay is the delay updated in the preset field by the nodes preceding the intermediate node.

[0174] In this embodiment of the disclosure, for intermediate nodes (such as Spine switches, Leaf switches, etc.) between the time server and the client, after receiving a synchronization message from the time server, the intermediate node extracts the stored port delay corresponding to the receiving port and directly updates the port delay in the sending timestamp (TS) field. At this time, the time data only includes the sending timestamp. Alternatively, the port update can be placed in another preset field of the synchronization message, in which case the time data includes the sending timestamp and the delay in the preset field. This operation is performed when the synchronization request message arrives at each intermediate node. For example, when it arrives at the next intermediate node, the node extracts the stored port delay corresponding to the receiving port and directly updates the sending timestamp (TS) field with this delay data, or adds the port delay to the delay in the preset field.

[0175] In this embodiment, the intermediate node updates the second port delay of a predetermined field in the synchronization message using the first port delay to obtain the updated time data. In this way, the client can quickly use the time data for time synchronization after receiving the synchronization message. Compared to solutions in related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and thus improving network performance.

[0176] Please refer to Figure 12, which is a flowchart of the time synchronization method provided in this embodiment of the present disclosure. S102 in Figure 2 can also be implemented by S1021 to S1022, which will be described in conjunction with the steps:

[0177] S1021. Based on the sending timestamp, the third port delay, and the receiving timestamp, determine the first time deviation; wherein, the third port delay is the delay between the client and the previous intermediate node.

[0178] In this embodiment of the disclosure, the client can calculate and determine the first time deviation based on the sending timestamp, the third port delay, and the receiving timestamp. The third port delay is the delay between the client and the preceding intermediate node.

[0179] In this embodiment of the disclosure, the client determines a first time deviation based on the difference between the sum of the sending timestamp, the third port delay, and the receiving timestamp.

[0180] In this embodiment of the disclosure, when the time data includes the sending timestamp; after the synchronization message arrives at the client, the client records the receiving timestamp TR, extracts the sending timestamp from the message, and extracts the final port delay Delay_client corresponding to the receiving port stored by the client. The client adds the updated sending timestamp TS extracted from the message to the final port delay Delay_client corresponding to the receiving port and subtracts the receiving timestamp TR to obtain the first time offset timeoffset between the client and the time server. For example, timeoffset can be determined by formula (1). Timeoffset=TS+Delay_client–TR Formula (1)

[0181] S1022. Adjust the system clock based on the first time deviation to perform time synchronization.

[0182] In this embodiment of the disclosure, the client adjusts the system clock according to the first time offset (timeoffset) to achieve synchronization with the time server.

[0183] Please refer to Figure 13, which is a flowchart illustrating the time synchronization method provided in this embodiment. S102 in Figure 2 can also be implemented via S1023 to S1024, which will be explained in conjunction with the steps:

[0184] S1023. Determine the second time deviation based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp.

[0185] In this embodiment of the disclosure, the client determines the second time deviation based on the difference between the sum of the sending timestamp, the second port delay, and the third port delay, and the receiving timestamp.

[0186] In this embodiment of the disclosure, the time data includes: the sending timestamp and the port delay in the predetermined field; the port delay in the predetermined field is determined using the port delay of each intermediate node; the client extracts the sending timestamp TS, the port delay Delay_update in the predetermined field, and the second time offset timeoffset between the client and the time server is calculated by adding the delay value Delay-update to the sending timestamp TS and subtracting the receiving timestamp TR from the final port delay Delay_client corresponding to the receiving port. The second time offset timeoffset can be determined by formula (2): Timeoffset=TS+Delay_update+Delay_client–TR Formula (2)

[0187] S1024. Adjust the system clock based on the second time deviation to perform time synchronization.

[0188] In this embodiment of the disclosure, the client adjusts the system clock according to the second time offset (timeoffset) to achieve synchronization with the time server.

[0189] Since the synchronization message can include not only the updated sending timestamp using port delay, but also the sending timestamp and the port delay of each intermediate node, the client can quickly synchronize its time after receiving the synchronization message. Compared with related technologies, this eliminates the need for multiple interactions with the time server, reduces network resource consumption, and thus improves network performance.

[0190] Please refer to Figure 14, which is a flowchart of the time synchronization method provided in this embodiment of the present disclosure. The steps shown will be described in conjunction with the following:

[0191] S401. Forward the synchronization message sent by the upper-layer node to the lower-layer node; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

[0192] In this embodiment, the time server responds to the synchronization request by sending a synchronization message to the client, carrying a timestamp. The synchronization message is then sent to the client via each intermediate node in the communication path. Each intermediate node, upon receiving the synchronization message forwarded by the upper-layer node, updates the time data in the synchronization message using the first port delay between itself and the upper-layer node, forming a new synchronization message, which is then forwarded to the next node until the synchronization message is sent to the client. The time data is used to characterize the delay in the communication path.

[0193] In this embodiment of the disclosure, each layer node can obtain the latency information between the ports of the upper layer nodes directly connected to it through periodic message exchange, and periodically update the port latency of each recorded port.

[0194] In this embodiment, a synchronization message sent by an upper-layer node is forwarded to a lower-layer node. The synchronization message is a message sent by a time server to the client. The synchronization message includes time data, which characterizes the latency in the communication path. Since the synchronization message includes not only the sending timestamp but also the latency between each intermediate node and the upper-layer node in the communication path, the client can quickly synchronize its time after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and improving network performance.

[0195] Please refer to Figure 15, which is a flowchart of the time synchronization method provided in this embodiment of the disclosure, and will be described in conjunction with the steps shown:

[0196] S501. Receive a synchronization request sent by a lower-level node, and forward the synchronization request to the upper-level node without processing it, until it is sent to the server.

[0197] In this embodiment of the disclosure, the client sends a synchronization request to the time server through intermediate nodes in the communication path. Each intermediate node receives the synchronization request sent by the lower-level node and forwards it directly to the upper-level node without processing it.

[0198] In this embodiment, intermediate nodes forward synchronization requests to upper-layer nodes without processing them, until the requests are sent to the server. This reduces the processing resource pressure on intermediate nodes, thereby improving network processing performance.

[0199] Please refer to Figure 16, which is a flowchart of the time synchronization method provided in this embodiment of the present disclosure. S401 in Figure 14 can also be implemented by S4011 to S4012. The combined steps will be described below:

[0200] S4011. Receive the synchronization message sent by the upper-layer node.

[0201] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the port of the upper-layer node.

[0202] S4012. Add the first port delay update to the sending timestamp in the synchronization message, determine the updated synchronization message, and forward it to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0203] In this embodiment of the disclosure, after receiving the synchronization message sent by the upper-layer node, the intermediate node can add the first port delay update between itself and the upper-layer node to the sending timestamp of the synchronization message to form a new sending timestamp, that is, to form new time data, and send the updated synchronization message to the next node until it is sent to the client.

[0204] In this embodiment, the intermediate node uses the first port delay to update the timestamp in the synchronization message to obtain the updated time data. This allows the client to quickly synchronize its time using the time data after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and improving network performance.

[0205] Please refer to Figure 17, which is a flowchart of the time synchronization method provided in this embodiment of the present disclosure. S401 in Figure 14 can also be implemented by S4013 to S4014. The combined steps will be described below:

[0206] S4013. Receive the synchronization message sent by the upper-layer node.

[0207] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the upper-layer node.

[0208] S4014. The first port delay update is added to the second port delay in the predetermined field of the synchronization message, the updated synchronization message is determined, and forwarded to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay of the node before the intermediate node after updating in the predetermined field.

[0209] In this embodiment of the disclosure, after each intermediate node receives a synchronization message sent by an upper-layer node, it can add the first port delay update between itself and the upper-layer node to the second port delay in a preset field of the synchronization message to form a new port delay. The updated synchronization message is then determined and forwarded to the lower-layer node until it is sent to the client. The preset field is different from the sending timestamp field. The time data includes the sending timestamp and the second port delay in the preset field. The second port delay is the delay updated in the preset field by the nodes preceding the intermediate node.

[0210] In this embodiment, the intermediate node updates the second port delay of a predetermined field in the synchronization message using the first port delay to obtain the updated time data. In this way, the client can quickly use the time data for time synchronization after receiving the synchronization message. Compared to solutions in related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and thus improving network performance.

[0211] Please refer to Figure 18, which is a flowchart of the time synchronization method provided in this embodiment of the disclosure, and will be described in conjunction with the steps shown in Figure 1:

[0212] S601. Interact with the corresponding upper-layer node to determine the first port delay between the upper-layer node and the corresponding upper-layer node.

[0213] In this embodiment of the disclosure, intermediate nodes send messages to upper-layer nodes at predetermined intervals, and determine the first port delay between them and the upper-layer nodes through the timestamps in the message exchanges. After determining the first port delay with the upper-layer nodes, the first port delay corresponding to the upper-layer nodes can also be stored.

[0214] In this embodiment of the disclosure, an intermediate node periodically sends a first message to the upper-layer node; wherein the first message corresponds to a first sending timestamp; the upper-layer node receives the first message and determines a first receiving timestamp of the first message; the upper-layer node sends a second message to the intermediate node; wherein the second message includes a second sending timestamp and the first receiving timestamp, or the second message includes the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message; the intermediate node receives the second message and, based on the first sending timestamp, the second message, and the second receiving timestamp, determines a first port delay between itself and the port of the upper-layer node; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the delayed response message.

[0215] In this embodiment, the port delay is determined by periodically exchanging messages between intermediate nodes and their corresponding upper-layer nodes. Thus, as the synchronization message passes through each intermediate node, the intermediate node can update the time data in the synchronization message using the port delay. Consequently, the client can quickly use the time data for time synchronization after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with a time server, reducing network resource consumption and improving network performance.

[0216] Please refer to Figure 19, which is a flowchart of the time synchronization method provided in this embodiment of the present disclosure. The steps shown will be described in conjunction with the following:

[0217] S701. Send a synchronization message to the client for the client to perform time synchronization; wherein, the synchronization message includes: time data; the time data is used to characterize the delay in the communication path.

[0218] In this embodiment, the time server responds to the synchronization request sent by the client by sending a synchronization message back to the client through intermediate nodes in the communication path. Each intermediate node, after receiving the synchronization message, can update the time data in the synchronization message using a pre-determined first port delay with the upper-layer node and forward it to the next node until the synchronization message reaches the client. The time data is used to characterize the delay in the communication path. After receiving the synchronization message, the client can synchronize and update the time in its local system based on the time data in the synchronization message.

[0219] In this embodiment, a synchronization message is sent to the client for time synchronization. The synchronization message includes time data, which characterizes the latency in the communication path. Because the synchronization message includes not only the sending timestamp but also the latency in the communication path, the client can quickly perform time synchronization after receiving the synchronization message. Compared to related technologies, this eliminates the need for multiple interactions with a time server, reducing network resource consumption and improving network performance.

[0220] In this embodiment of the disclosure, step S701 may be included before step S601, which will be described in conjunction with the steps:

[0221] S801: Receive synchronization requests sent by the client.

[0222] In this embodiment of the disclosure, the client sends a synchronization request to the time server through an intermediate node in the network communication path. The synchronization request is used to request the time server to respond with a synchronization message so that the client can synchronize its time.

[0223] In this embodiment of the disclosure, the time server responds to the synchronization request by sending the synchronization message to the client through various intermediate nodes; wherein, the synchronization message includes a sending timestamp.

[0224] Because the synchronization message includes not only the sending timestamp but also the latency in the communication path, the client can quickly synchronize its time after receiving the synchronization message. Compared with related technologies, this eliminates the need for multiple interactions with the time server, reducing network resource consumption and thus improving network performance.

[0225] Please refer to Figure 20, which is an interactive schematic diagram of the time synchronization method provided in this embodiment of the disclosure. The steps shown will be described in conjunction with the figure:

[0226] S801. The client receives a synchronization message sent by the time server; wherein, the synchronization message includes: time data; the time data is used to characterize the delay in the communication path.

[0227] In this embodiment, the implementation steps in S801 can be referred to S101, and will not be described in detail here.

[0228] S802. The client performs time synchronization based on the time data and the timestamp of the received synchronization message.

[0229] In this embodiment, the implementation steps in S802 can be referred to S102, and will not be described in detail here.

[0230] Please refer to Figure 21, which is a schematic diagram of the structure of a time synchronization device provided in an embodiment of this disclosure.

[0231] This disclosure also provides a time synchronization device 400 for a client, comprising: a first receiving unit 401 and a time synchronization unit 402.

[0232] The first receiving unit 401 is used to receive a synchronization message sent by a time server; wherein the synchronization message includes time data; the time data is used to characterize the delay in the communication path;

[0233] The time synchronization unit 402 is used to perform time synchronization based on the time data and the received timestamp of the synchronization message.

[0234] In this embodiment of the disclosure, the intermediate node interacts with the corresponding upper-layer node to determine the first port delay between the intermediate node and the corresponding upper-layer node.

[0235] In this embodiment of the disclosure, the intermediate node periodically sends a first message to the upper-layer node; wherein, the first message corresponds to a first sending timestamp;

[0236] The upper-layer node receives the first message and determines the first reception timestamp of the first message;

[0237] The upper-layer node sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message;

[0238] The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the second message.

[0239] In this embodiment of the disclosure, the time synchronization device 400 is used to send a synchronization request to the time server.

[0240] In this embodiment of the disclosure, the intermediate node receives the synchronization request sent by the lower-level node, forwards the synchronization request to the upper-level node without processing it, and so on, until it is sent to the server.

[0241] In this embodiment of the disclosure, the time server responds to the synchronization request by sending the synchronization message to the client through various intermediate nodes; wherein, the synchronization message includes a sending timestamp.

[0242] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the upper-layer node;

[0243] The intermediate node adds the first port delay update to the sending timestamp in the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0244] In this embodiment of the disclosure, the intermediate node receives the synchronization message sent by the upper-layer node;

[0245] The intermediate node adds the first port delay update to the second port delay in the predetermined field of the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay updated in the predetermined field by the node before the intermediate node.

[0246] In this embodiment of the disclosure, the time synchronization unit 402 in the time synchronization device 400 is used to determine a first time deviation based on the sending timestamp, the third port delay, and the receiving timestamp; wherein, the third port delay is the delay between the client and the previous intermediate node;

[0247] The system clock is adjusted based on the first time deviation to achieve time synchronization.

[0248] In this embodiment of the disclosure, the time synchronization unit 402 in the time synchronization device 400 is used to determine a first time deviation based on the difference between the sum of the sending timestamp, the third port delay, and the receiving timestamp.

[0249] In this embodiment of the disclosure, the time synchronization unit 402 in the time synchronization device 400 is used to determine a second time deviation based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp;

[0250] The system clock is adjusted based on the second time deviation to achieve time synchronization.

[0251] In this embodiment of the disclosure, the time synchronization unit 402 in the time synchronization device 400 is used to determine a second time deviation based on the difference between the sum of the sending timestamp, the second port delay, and the third port delay, and the receiving timestamp.

[0252] It should be noted that, in the embodiments of this disclosure, if the above-described time synchronization method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this disclosure, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an item information processing device (which may be a personal computer, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a magnetic disk, or an optical disk. Thus, the embodiments of this disclosure are not limited to any specific hardware and software combination.

[0253] Correspondingly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method on one side of the time synchronization device 400.

[0254] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.

[0255] It should be noted that Figure 22 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this disclosure. As shown in Figure 22, an embodiment of this disclosure provides an electronic device 500, including a first memory 502 and a first processor 501. The first memory 502 stores a computer program that can run on the first processor 501. When the first processor 501 executes the program, it implements the steps in the above method, wherein;

[0256] The first processor 501 typically controls the overall operation of the electronic device 500.

[0257] The first memory 502 is configured to store instructions and applications executable by the first processor 501, and can also cache data to be processed or already processed by the first processor 501 and various modules in the electronic device 500 (e.g., image data, audio data, voice communication data and video communication data), which can be implemented by flash memory or random access memory (RAM).

[0258] Correspondingly, this disclosure also provides a computer program product, including a computer program that can be executed by a first processor 501 of an electronic device 500 to complete the steps in the method of the time synchronization device 400.

[0259] Please refer to Figure 23, which is a second structural schematic diagram of the time synchronization device provided in the embodiments of this disclosure.

[0260] This disclosure also provides a time synchronization device 600, applied to an intermediate node, including a forwarding unit 601.

[0261] The forwarding unit 601 is used to forward synchronization messages sent by upper-layer nodes to lower-layer nodes; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

[0262] In this embodiment of the disclosure, the forwarding unit 601 in the time synchronization device 600 is used to receive the synchronization request sent by the lower-level node, and forward the synchronization request to the upper-level node without processing it, until it is sent to the server.

[0263] In this embodiment of the disclosure, the forwarding unit 601 in the time synchronization device 600 is used to receive the synchronization message sent by the upper-layer node;

[0264] The first port delay update is added to the sending timestamp in the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

[0265] In this embodiment of the disclosure, the forwarding unit 601 in the time synchronization device 600 is used to receive the synchronization message sent by the upper-layer node;

[0266] The first port delay update is added to the second port delay in the predetermined field of the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay of the node before the intermediate node after updating in the predetermined field.

[0267] In this embodiment of the disclosure, the time synchronization device 600 is used to interact with the corresponding upper-layer node to determine the first port delay between the device and the corresponding upper-layer node.

[0268] In this embodiment of the disclosure, the time synchronization device 600 is used to store the delay of the first port corresponding to the upper-layer node.

[0269] In this embodiment of the disclosure, the time synchronization device 600 is used to periodically send a first message to the upper-layer node; wherein, the first message corresponds to a first sending timestamp;

[0270] The upper-layer node receives the first message and determines the first reception timestamp of the first message;

[0271] The upper-layer node sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message;

[0272] The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the delayed response message.

[0273] Correspondingly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method on one side of the time synchronization device 600.

[0274] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.

[0275] It should be noted that Figure 24 is a second hardware entity schematic diagram of an electronic device provided in an embodiment of this disclosure. As shown in Figure 24, an embodiment of this disclosure provides an electronic device 700, including a second memory 702 and a second processor 701. The second memory 702 stores a computer program that can run on the second processor 701. When the second processor 701 executes the program, it implements the steps in the above method, wherein;

[0276] The second processor 701 typically controls the overall operation of the electronic device 700.

[0277] The second memory 702 is configured to store instructions and applications executable by the second processor 701, and can also cache data to be processed or already processed by the second processor 701 and various modules in the electronic device 700 (e.g., image data, audio data, voice communication data, and video communication data), which can be implemented by flash memory or random access memory (RAM).

[0278] Correspondingly, this disclosure also provides a computer program product, including a computer program that can be executed by a second processor 701 of an electronic device 700 to complete the steps in the method of the time synchronization device 600.

[0279] Please refer to Figure 25, which is a schematic diagram of the structure of the time synchronization device provided in the embodiments of this disclosure.

[0280] This disclosure also provides a time synchronization device 800, applied to a time server, including: a second sending unit 801.

[0281] The second sending unit 801 is used to send a synchronization message to the client for the client to perform time synchronization.

[0282] The synchronization message includes time data, which is used to characterize the latency in the communication path.

[0283] In this embodiment of the disclosure, the time synchronization device 800 is used to receive a synchronization request sent by the client.

[0284] In this embodiment of the disclosure, the second sending unit 801 in the time synchronization device 800 is used to respond to the synchronization request and send the synchronization message to the client through each intermediate node; wherein, the synchronization message includes: a sending timestamp.

[0285] Correspondingly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a method on one side of a time synchronization device 800.

[0286] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.

[0287] It should be noted that Figure 26 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of this disclosure. As shown in Figure 26, an embodiment of this disclosure provides an electronic device 900, including a third memory 902 and a third processor 901. The third memory 902 stores a computer program that can run on the third processor 901. When the third processor 901 executes the program, it implements the steps in the above method, wherein;

[0288] The third processor 901 typically controls the overall operation of the electronic device 900.

[0289] The third memory 902 is configured to store instructions and applications executable by the third processor 901, and can also cache data to be processed or already processed by the third processor 901 and various modules in the electronic device 900 (e.g., image data, audio data, voice communication data, and video communication data), which can be implemented by flash memory or random access memory (RAM).

[0290] Correspondingly, this disclosure also provides a computer program product, including a computer program that can be executed by a third processor 901 of an electronic device 900 to complete the steps in the method of the time synchronization device 800.

[0291] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this disclosure. Therefore, "in one embodiment" or "one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this disclosure, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure. The sequence numbers of the above-described embodiments are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0292] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0293] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the apparatus or units may be electrical, mechanical, or other forms.

[0294] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0295] In addition, each functional unit in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0296] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0297] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this disclosure, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0298] The above description is merely an embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.

Claims

1. A time synchronization method applied to a client, the method comprising: The system receives a synchronization message sent by a time server; wherein the synchronization message includes time data; the time data is used to characterize the latency in the communication path. Time synchronization is performed based on the time data and the received timestamp of the synchronization message.

2. The time synchronization method according to claim 1, wherein, Before receiving the synchronization message sent by the time server, the method further includes: The intermediate node interacts with the corresponding upper-level node to determine the first port delay between the intermediate node and the corresponding upper-level node.

3. The time synchronization method according to claim 2, wherein, The intermediate node interacts with the corresponding upper-layer node to determine the first port delay between itself and the corresponding upper-layer node, including: The intermediate node periodically sends a first message to the upper-layer node; wherein the first message corresponds to a first sending timestamp; The upper-layer node receives the first message and determines the first reception timestamp of the first message; The upper-layer node sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message; The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the second message.

4. The time synchronization method according to claim 1, wherein, Before receiving the synchronization message sent by the time server, the method further includes: Send a synchronization request to the time server.

5. The time synchronization method according to claim 4, further comprising: The intermediate node receives the synchronization request sent by the lower-level node, forwards the synchronization request to the upper-level node without processing it, and so on, until it is sent to the server.

6. The time synchronization method according to claim 4, further comprising: The time server responds to the synchronization request by sending the synchronization message to the client through various intermediate nodes; wherein the synchronization message includes a sending timestamp.

7. The time synchronization method according to claim 6, further comprising: The intermediate node receives the synchronization message sent by the upper-layer node; The intermediate node adds the first port delay update to the sending timestamp in the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

8. The time synchronization method according to claim 6, further comprising: The intermediate node receives the synchronization message sent by the upper-layer node; The intermediate node adds the first port delay update to the second port delay in the predetermined field of the synchronization message, determines the updated synchronization message, and forwards it to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay updated in the predetermined field by the node before the intermediate node.

9. The time synchronization method according to claim 7, wherein, The time synchronization based on the time data and the received timestamp of the synchronization message includes: Based on the sending timestamp, the third port delay, and the receiving timestamp, a first time deviation is determined; wherein, the third port delay is the delay between the client and the previous intermediate node; The system clock is adjusted based on the first time deviation to achieve time synchronization.

10. The time synchronization method according to claim 9, wherein, The determination of the first time deviation based on the sending timestamp, the third port delay, and the receiving timestamp includes: The first time deviation is determined based on the difference between the sum of the sending timestamp and the third port delay and the receiving timestamp.

11. The time synchronization method according to claim 8, wherein, The time synchronization based on the time data and the received timestamp of the synchronization message includes: The second time deviation is determined based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp; The system clock is adjusted based on the second time deviation to achieve time synchronization.

12. The time synchronization method according to claim 11, wherein, The determination of the second time deviation based on the sending timestamp, the second port delay, the third port delay, and the receiving timestamp includes: The second time deviation is determined based on the difference between the sum of the sending timestamp, the second port delay, and the third port delay, and the receiving timestamp.

13. A time synchronization method applied to an intermediate node, the method comprising: Forward the synchronization message sent by the upper-layer node to the lower-layer node; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

14. The time synchronization method according to claim 13, wherein, Before forwarding the synchronization message sent by the upper-layer node to the lower-layer node, the method further includes: The system receives synchronization requests from lower-level nodes, forwards them to upper-level nodes without processing, and continues this process until the request is sent to the server.

15. The time synchronization method according to claim 13, wherein, The forwarding of synchronization messages sent by the upper-layer node to the lower-layer node includes: Receive the synchronization message sent by the upper-layer node; The first port delay update is added to the sending timestamp in the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the time data includes: the sending timestamp.

16. The time synchronization method according to claim 13, wherein, The forwarding of synchronization messages sent by the upper-layer node to the lower-layer node includes: Receive the synchronization message sent by the upper-layer node; The first port delay update is added to the second port delay in the predetermined field of the synchronization message to determine the updated synchronization message, and forwarded to the lower-level node until it is sent to the client; wherein, the predetermined field is different from the sending timestamp field; the time data includes: the sending timestamp and the second port delay in the predetermined field; the second port delay is the delay of the node before the intermediate node after updating in the predetermined field.

17. The time synchronization method according to claim 13, further comprising: Interact with the corresponding upper-layer node to determine the first port delay between the upper-layer node and the corresponding upper-layer node.

18. The time synchronization method according to claim 17, further comprising: Store the delay of the first port corresponding to the upper-layer node.

19. The time synchronization method according to claim 17, wherein, The interaction with the corresponding upper-layer node to determine the first port delay between the upper-layer node and the corresponding upper-layer node includes: A first message is periodically sent to the upper-layer node; wherein the first message corresponds to a first sending timestamp; The upper-layer node receives the first message and determines the first reception timestamp of the first message; The upper-layer node sends a second message to the intermediate node; wherein the second message includes: a second sending timestamp and a first receiving timestamp, or the second message includes: the difference between the second sending timestamp and the first receiving timestamp; the second sending timestamp is the timestamp at which the upper-layer node sends the delayed response message; The intermediate node receives the second message and determines the first port delay between itself and the upper-layer node port based on the first sending timestamp, the second message, and the second receiving timestamp; wherein the second receiving timestamp is the timestamp at which the intermediate node receives the delayed response message.

20. A time synchronization method applied to a time server, the method comprising: Send a synchronization message to the client so that the client can perform time synchronization; The synchronization message includes time data, which is used to characterize the latency in the communication path.

21. The time synchronization method according to claim 20, wherein, Before sending the synchronization message back to the client, the method further includes: Receive synchronization requests sent by the client.

22. The time synchronization method according to claim 21, wherein, Sending a synchronization message to the client includes: In response to the synchronization request, the synchronization message is sent to the client through each intermediate node; wherein the synchronization message includes a sending timestamp.

23. A time synchronization device, applied to a client, the device comprising: The first receiving unit is configured to receive a synchronization message sent by a time server; wherein the synchronization message includes time data; the time data is used to characterize the latency in the communication path; The time synchronization unit is used to perform time synchronization based on the time data and the received timestamp of the synchronization message.

24. A time synchronization device applied to an intermediate node, the device comprising: A forwarding unit is used to forward synchronization messages sent by upper-layer nodes to lower-layer nodes; wherein, the synchronization message is a message sent by the time server to the client; the synchronization message includes time data, which is used to characterize the latency in the communication path.

25. A time synchronization device, applied to a time server, the device comprising: The second sending unit is used to send a synchronization message to the client for the client to perform time synchronization. The synchronization message includes time data, which is used to characterize the latency in the communication path.

26. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 12, or implements the steps of the method of any one of claims 13 to 19, or implements the steps of the method of any one of claims 20 to 22.

27. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 12, or the steps of the method according to any one of claims 13 to 19, or the steps of the method according to any one of claims 20 to 22.

28. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 12, or the steps of the method according to any one of claims 13 to 19, or the steps of the method according to any one of claims 20 to 22.