Network time protocol optimization method for asymmetric channel and related device

By collecting the time difference of multiple data packets on the client side and calculating the correction value, the local clock is adjusted, which solves the problem of poor accuracy and stability of NTP time synchronization in asymmetric channels and achieves higher accuracy and stable time synchronization.

CN120915408APending Publication Date: 2025-11-07STATE GRID SHANGHAI MUNICIPAL ELECTRIC POWER CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511061178.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Existing NTP timing technology suffers from poor timing accuracy and stability when dealing with asymmetric channels. In particular, when network conditions are asymmetric, the asymmetry in round-trip routing delays leads to a significant increase in timing errors. Traditional data processing algorithms cannot effectively improve time synchronization accuracy and stability in local area networks and wide area networks.

Method used

The client continuously collects multiple sets of response data packets from interactions with the server, filters out the minimum difference between the arrival time and transmission time on each path of the request and response data packets, calculates correction values, and adjusts the local clock to offset errors introduced by network fluctuations and path asymmetry.

Benefits of technology

It significantly reduces timing errors, improves the accuracy and stability of clock synchronization, is suitable for LAN and WAN environments, and enhances the reliability and anti-interference capability of time synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120915408A_ABST
    Figure CN120915408A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of user side resource aggregation regulation and control networks, and discloses an asymmetric channel-oriented network time protocol optimization method and a related device. And respectively screening out the minimum value of the time difference between the arrival time and the transmission time on each path of the request data packet and the response data packet. A correction value calculated based on the two minimum difference values is used for adjusting a local clock, and system errors caused by asymmetry of a round-trip path can be effectively counteracted. By adopting the method, the time service error caused by asymmetry and instantaneous fluctuation of a network path is remarkably reduced, and the defects of precision and stability of the traditional NTP single communication or a simple mean value algorithm in the scene are effectively overcome; meanwhile, the core bidirectional screening minimum value method has better adaptability to the local area network and the wide area network environment, and the precision and robustness of time synchronization can be stably improved without depending on a specific network topology or a complex preferential algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of communication, and particularly relates to the technical field of user-side resource aggregation regulation network, and especially relates to a network time protocol optimization method for asymmetric channels and related devices. BACKGROUND

[0002] In the current field of user-side resource aggregation regulation network, in order to ensure that all nodes with clocks in the network can work accurately and cooperatively, the clocks of all devices in the network need to be kept consistent. NTP (Network Time Protocol) is widely selected because it can realize the synchronization of the clock nodes in the user-side resource aggregation regulation network in a relatively economical way. The working mode is mainly server / client mode, and the clock is calculated and adjusted by the client and server interacting with NTP packets.

[0003] However, the existing NTP time service has some problems in actual application, which are embodied in the following aspects. On the one hand, the accuracy of NTP time service is highly dependent on the network condition between the NTP server and the user, especially the symmetry of the round-trip delay of NTP packets. When the asymmetry of the round-trip delay is too large, the time service error will increase significantly. On the other hand, the traditional data processing algorithm has limitations under different network types. In a local area network, a simple data convergence algorithm cannot fully cope with complex network conditions. In a wide area network, the optimal selection of the server is not accurate and efficient, and it is difficult to effectively improve the time synchronization accuracy and stability. In addition, the single communication of the existing NTP client and server is greatly affected by network fluctuations, and the asymmetry of the round-trip delay leads to a large time service error.

[0004] As can be seen, the existing NTP-based clock synchronization technology has poor time service accuracy and stability due to the inherent asymmetry of the round-trip delay in single communication. SUMMARY

[0005] The present application provides a network time protocol optimization method for asymmetric channels and related devices. The method converts the path delay asymmetry of single communication into the minimum delay asymmetry of multiple communications, significantly reduces the time service error, and improves the accuracy and stability of clock synchronization.

[0006] In order to achieve the above purpose, the present application adopts the following technical solutions: In a first aspect, the present application provides a network time protocol optimization method for asymmetric channels, applied to a client, comprising: continuously obtaining response data packets sent by the server until a preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by the client to the server; screening the minimum difference between the arrival time and the transmission time of the request data packet from the difference between the arrival time and the transmission time of all groups of request data packets; screening the minimum difference between the arrival time and the transmission time of the response data packet from the difference between the arrival time and the transmission time of all groups of response data packets; wherein the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; and the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; calculating a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the client adjusts the local clock according to the correction value.

[0007] The application further improves that the server continuously sends the response data packet until a preset group number is reached. The server continuously sends the response data packet until a preset group number is reached.

[0008] The application further improves that the server continuously sends the response data packet until a preset group number is reached. The server continuously sends the response data packet until a preset group number is reached. The application further improves that the server continuously sends the response data packet until a preset group number is reached.

[0009] The application further improves that the server continuously sends the response data packet until a preset group number is reached. The application further improves that the server continuously sends the response data packet until a preset group number is reached. The application further improves that the server continuously sends the response data packet until a preset group number is reached.

[0010] The application further improves that the server continuously sends the response data packet until a preset group number is reached. In all groups, the arrival time and transmission time difference of the request data packet is compared, and the minimum value is selected as the minimum difference between the arrival time and transmission time of the request data packet. In all groups, the arrival time and transmission time difference of the response data packet is compared, and the minimum value is selected as the minimum difference between the arrival time and transmission time of the response data packet.

[0011] The application further improves that the minimum difference between the arrival time and transmission time of the request data packet and the minimum difference between the arrival time and transmission time of the response data packet are used to calculate the correction value, comprising: The minimum difference between the arrival time and transmission time of the request data packet is obtained, and the minimum difference between the arrival time and transmission time of the response data packet is obtained. According to the difference between the minimum difference between the arrival time and transmission time of the request data packet and the minimum difference between the arrival time and transmission time of the response data packet, the correction value is calculated, and the specific formula is as follows: θ=(min_D_res-min_D_req) / 2 In the formula, θ represents the correction value; min_D_req represents the minimum difference between the arrival time and transmission time of the request data packet; and min_D_res represents the minimum difference between the arrival time and transmission time of the response data packet.

[0012] The application further improves that the client adjusts the local clock according to the correction value, comprising: According to the calculated correction value, the client adjusts the local clock to synchronize with the server time, wherein: If θ>0, the client adjusts the local clock forward by θ; If θ<0, the client adjusts the local clock backward by θ.

[0013] In the second aspect, the application provides a network time protocol optimization system for asymmetric channel, comprising: The receiving module is used for continuously obtaining the response data packet sent by the server until the preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by the client to the server; The screening module is configured to screen a minimum difference between the arrival time and the transmission time of the request data packet from among differences between the arrival time and the transmission time of all groups of request data packets, and to screen a minimum difference between the arrival time and the transmission time of the response data packet from among differences between the arrival time and the transmission time of all groups of response data packets, wherein the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet, and the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; The time correction module is configured to calculate a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the local clock is adjusted according to the correction value by the client.

[0014] In a third aspect, the present application provides a network time protocol optimization device for an asymmetric channel, comprising: a memory configured to store a computer program; a processor configured to execute the computer program to implement the steps of the network time protocol optimization method for an asymmetric channel.

[0015] In a fourth aspect, the present application provides a computer readable storage medium storing a computer program, wherein the computer program is configured to be executed by a processor to implement the steps of the network time protocol optimization method for an asymmetric channel.

[0016] Compared with the prior art, the present application has the following beneficial effects: The present application provides a network time protocol optimization method for an asymmetric channel, which continuously collects multiple groups of response data packets interacting with a server by a client, and screens minimum values of differences between arrival times and transmission times of request data packets and response data packets on respective paths. In network transmission, the minimum difference measured on each one-way path is closest to the ideal transmission delay of the path. By selecting the minimum differences of the two-way paths to calculate, the interference of network fluctuations and random queuing delays on measurement is maximized to filter out, so that the inherent fixed delay component of the two-way link is more accurately approximated. The correction value calculated based on the two minimum differences is used to adjust the local clock, which can effectively offset the system error caused by the asymmetry of the round-trip path. The present application significantly reduces the time error caused by network path asymmetry and instantaneous fluctuations, effectively overcomes the precision and stability defects of the traditional NTP single communication or simple mean algorithm in such scenarios; at the same time, the core two-way screening minimum value method has better adaptability to local area networks and wide area networks, and does not need to rely on specific network topology or complex optimization algorithms, but can stably improve the precision and robustness of time synchronization. Preferably, in the present application, before continuously obtaining the response packet, the client continuously sends multiple groups of request data packets until a preset number of groups. By actively sending multiple groups of request packets, enough data sample groups are generated for subsequent analysis, avoiding calculation bias caused by insufficient data. Multiple groups of data can smooth out transient network jitter and provide more comprehensive transmission characteristics. This can enhance the integrity of data collection, improve the reliability and accuracy of overall time synchronization, and reduce random errors introduced by insufficient sample size.

[0017] Preferably, in the present application, the process of continuously obtaining the response packet includes receiving the response packet and recording its transmission time and arrival time. By recording the timestamp data completely, the original input for difference calculation is provided, ensuring the continuity of subsequent steps. Accurate timestamp capture is the key foundation, which can truly reflect the network transmission delay characteristics. This can ensure the accuracy of data processing, lay a reliable foundation for minimum difference screening, and thus improve the robustness of correction value calculation and the effectiveness of the overall scheme Preferably, in the present application, before screening the minimum difference, the difference between the arrival time and the transmission time of each group of request packets and response packets is calculated. The original timestamp is converted into a difference index that can be directly compared, realizing data preprocessing. Difference calculation directly quantifies one-way path delay, which is a necessary pre-operation for screening the minimum value. This approach can improve data processing efficiency, avoid introducing additional errors in the screening stage, and ensure the accurate execution of the core optimization logic.

[0018] Preferably, in the present application, the method of screening the minimum difference is adopted: by comparing all group differences and selecting the minimum value. This process uses the principle of extreme value statistics to extract the minimum delay value from multiple groups of data, representing the state closest to the fixed transmission delay. The minimum value corresponds to the ideal time point in the path with the smallest network interference, effectively suppressing the impact of sudden fluctuations. This approach optimizes the reliability of path delay estimation, enhances the anti-interference capability of time synchronization, and can be applied to various network environments. BRIEF DESCRIPTION OF DRAWINGS

[0019] Figure 1 A server / client mode working schematic diagram is provided for an embodiment of the present application; Figure 2 A flowchart of a client network time protocol optimization method is provided for an embodiment of the present application; Figure 3 A flowchart of a server network time protocol optimization method is provided for an embodiment of the present application; Figure 4 A flowchart of a network time protocol optimization method for asymmetric channels is provided for an embodiment of the present application; Figure 5 A structural schematic diagram of a network time protocol optimization system for asymmetric channels is provided for an embodiment of the present application. Detailed Implementation

[0020] To further understand the content of this invention, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments are merely illustrative and not limiting of the invention.

[0021] The following explanations are provided for the technical terms: NTP: Network Time Protocol, is a protocol used to synchronize the time of devices in a computer network.

[0022] This embodiment provides a network time protocol optimization method for asymmetric channels, applied to a client, including: Continuously acquire response data packets sent by the server until a preset number of groups is reached; where each group of response data packets corresponds to each group of request data packets sent by the client to the server. Among the differences between the arrival time and transmission time of all request data packets, the minimum difference between the arrival time and transmission time of the request data packets is selected; among the differences between the arrival time and transmission time of all response data packets, the minimum difference between the arrival time and transmission time of the response data packets is selected; wherein, the difference between the arrival time and transmission time of the request data packets is calculated based on the transmission time and arrival time of the request data packets; the difference between the arrival time and transmission time of the response data packets is calculated based on the transmission time and arrival time of the response data packets. A correction value is calculated based on the minimum difference between the arrival time and transmission time of the request packet and the minimum difference between the arrival time and transmission time of the response packet, so that the client can adjust its local clock according to the correction value.

[0023] The technical solution provided in this embodiment will be further explained below with reference to the accompanying drawings: This embodiment provides a network time protocol optimization method for asymmetric channels, and the specific design principle is as follows: Figure 1 As shown, Figure 1 This is a schematic diagram of the server / client mode working principle. In this embodiment, the more economical NTP time synchronization method is selected. The clock synchronization is performed on all nodes with clocks in the network for user-side resource aggregation and control, so that the clocks of all devices in the network are consistent.

[0024] The client sends an NTP packet (request packet) at time T1, the server receives the NTP packet sent by the client at time T1 at time T2, and returns time information to the client at time T3, and the client receives the time information returned by the server at time T4. The clock level of the server is superior to that of the client, the time error of the two is t, the path delay from the client to the server is d1, the path delay from the server to the client is d2, and the sum of the path delays of the two is d, then:

[0025] Among them, assuming that the transmission delay of the NTP request packet and the return packet (response packet) is equal, d1=d2 is substituted to obtain:

[0026]

[0027] In the formula, T1 represents the transmission time of the request packet; T2 represents the arrival time of the request packet; T3 represents the transmission time of the response packet; T4 represents the arrival time of the response packet; wherein the transmission time can also be called the sending time.

[0028] From the above formula, it can be seen that t and d are only related to the difference between T2 and T1 and the difference between T3 and T4, and are independent of the difference between T2 and T3, that is, the final result is independent of the time required by the server to process the request. Therefore, the client can calculate the time difference t to adjust the local clock by T1, T2, T3 and T4.

[0029] The NTP time service accuracy is related to the network condition between the NTP server and the user, mainly depends on the symmetry degree of the delay of the NTP packet round trip route, and the maximum delay asymmetry value of the round trip route does not exceed the network delay. The formula is obtained under the assumption that the transmission delay of the NTP request packet and the return packet on the network is equal, that is, d1=d2=d / 2, and the value range of d1 and d2 is (0...d), and the maximum time service error is ±d / 2.

[0030] Therefore, according to the type of network, the corresponding data processing algorithm needs to be adopted, in a local area network with only one server device, the NTP protocol stipulates that the data convergence algorithm is used to filter the calculated time error; in a multi-level and high complexity wide area network, the client device will first calculate the evaluation factor of the server clock and the synchronization distance as the evaluation index of the server clock, so as to optimize the multiple servers, thereby improving the time synchronization accuracy and stability.

[0031] ​Generally, the clock deviation caused by the device clock frequency deviation can be ignored in a short time, and the clock deviation is far less than 1ms in 1 second, usually in microseconds. If the client continuously sends request messages in a short time, so the smaller, the smaller, similarly, the server continuously sends response messages (response packets) in a short time, so the smaller, the smaller.

[0032] Based on the above design principle, the embodiment provides a network time protocol optimization method for an asymmetric channel, which comprises the following steps: The client and the server continuously interact with 10 groups of request and response messages, and after each group is completed, the system time is not immediately calculated and adjusted, but the smallest and is selected from the 10 groups of data, and then the correction value (clock deviation) is calculated by using the smallest and . In this way, the time error source is converted from the asymmetry of the round-trip delay in single communication to the asymmetry of the smallest round-trip delay in multiple communications. Obviously, the smallest delay is closer to the inherent delay and is less affected by network fluctuations, and is more symmetrical, thereby improving the accuracy and stability of clock synchronization.

[0033] As Figure 2 shown, in the embodiment, the client sends a request message, and when the client receives a response message from the server, the number of received response messages count is recorded by recording all message sending and arrival time statistics; when the number count is less than 10, the request message continues to be sent until the count is equal to 10; the smallest and are selected from all groups of and ; the clock deviation is calculated by using the smallest and , and the local clock is calibrated according to the calculated clock deviation.

[0034] As Figure 3 shown, in the embodiment, the server process is in a standby state, continuously receives the request message sent by the client, and records the arrival time; sends a response message to the client, and the response message is filled with the sending time information of the response message of the arrival time of the request message.

[0035] Exemplarily, the optimization scheme provided by the embodiment is applied, and the specific implementation steps are as follows: The client first continuously sends multiple groups of request data packets to the server side, for example, a preset number of groups is N groups, the client continuously sends request data packets until the number of groups of request data packets sent reaches N groups.

[0036] In the process of sending request data packets, for each group of request data packets, the client records the transmission time of the request data packet, that is, the time when the client sends the request data packet. When the server side receives the request data packet, it will send a response data packet to the client, and the client continuously receives the response data packet sent by the server side until the number of groups of response data packets received reaches N groups. When receiving the response data packet, the client records the transmission time of each response data packet, that is, the time when the server side sends the response data packet, and the arrival time of the response data packet, that is, the time when the client receives the response data packet.

[0037] Next, the client calculates the difference between the arrival time and the transmission time of each group of request data packets based on the transmission time and the arrival time of the request data packet. The arrival time of the request data packet here refers to the time when the server side receives the request data packet, which can be carried by the server side to the client in the response data packet. For each group of request data packets, subtract the transmission time from the arrival time to obtain the difference between the arrival time and the transmission time of the request data packet. Similarly, based on the transmission time and the arrival time of each group of response data packets, subtract the transmission time from the arrival time to calculate the difference between the arrival time and the transmission time of each group of response data packets.

[0038] Then, the client compares all the differences between the arrival time and the transmission time of the request data packets and finds the minimum value, which is taken as the minimum difference between the arrival time and the transmission time of the request data packet. Similarly, compare all the differences between the arrival time and the transmission time of the response data packets and filter out the minimum value as the minimum difference between the arrival time and the transmission time of the response data packet.

[0039] After the client obtains the minimum difference min_D_req between the arrival time and the transmission time of the request data packet and the minimum difference min_D_res between the arrival time and the transmission time of the response data packet, the correction value θ is calculated according to the formula θ=(min_D_res-min_D_req) / 2.

[0040] Finally, the client adjusts the local clock according to the calculated correction value θ to achieve time synchronization with the server end. If θ is greater than 0, it indicates that the local clock of the client is slower than the server end clock, and the client adjusts the local clock forward by θ; if θ is less than 0, it indicates that the local clock of the client is faster than the server end clock, and the client adjusts the local clock backward by θ, thereby completing the adjustment of the local clock and achieving time synchronization between the client and the server end. For example: if θ = 0.1 seconds, the client adjusts the clock forward by 0.1 seconds. If θ = -0.05 seconds, the client adjusts the clock backward by 0.05 seconds.

[0041] As shown in FIG. 1, Figure 4 The embodiment provides a network time protocol optimization method for an asymmetric channel, including the following steps: A network time protocol optimization method for an asymmetric channel, applied to a client, includes: Continuously acquiring response data packets sent by the server end until a preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by the client to the server end; Among the differences between the arrival time and the transmission time of all groups of request data packets, the minimum difference between the arrival time and the transmission time of the request data packets is selected; among the differences between the arrival time and the transmission time of all groups of response data packets, the minimum difference between the arrival time and the transmission time of the response data packets is selected; wherein the difference between the arrival time and the transmission time of the request data packets is calculated based on the transmission time of the request data packets and the arrival time of the request data packets; the difference between the arrival time and the transmission time of the response data packets is calculated based on the transmission time of the response data packets and the arrival time of the response data packets; Based on the minimum difference between the arrival time and the transmission time of the request data packets and the minimum difference between the arrival time and the transmission time of the response data packets, a correction value is calculated for the client to adjust the local clock according to the correction value.

[0042] In the embodiment, before continuously acquiring the response data packets sent by the server end until the preset group number is reached, it includes: Continuously sending multiple groups of request data packets to the server end until the preset group number is reached.

[0043] In the embodiment, continuously acquiring the response data packets sent by the server end until the preset group number is reached, includes: Continuously receiving response data packets sent by the server end until the preset group number is reached; Recording the transmission time and arrival time of the response data packets corresponding to all response data packets.

[0044] In the embodiment, the minimum difference between the arrival time and the transmission time of the request data packet is filtered from the differences between the arrival time and the transmission time of all groups of request data packets; the minimum difference between the arrival time and the transmission time of the response data packet is filtered from the differences between the arrival time and the transmission time of all groups of response data packets, including: The difference between the arrival time and the transmission time of each group of request data packets is calculated based on the transmission time of each group of request data packets and the arrival time of the request data packet; The difference between the arrival time and the transmission time of each group of response data packets is calculated based on the transmission time of each group of response data packets and the arrival time of the response data packet.

[0045] In the embodiment, the minimum difference between the arrival time and the transmission time of the request data packet is filtered from the differences between the arrival time and the transmission time of all groups of request data packets; the minimum difference between the arrival time and the transmission time of the response data packet is filtered from the differences between the arrival time and the transmission time of all groups of response data packets, including: The minimum value is filtered as the minimum difference between the arrival time and the transmission time of the request data packet by comparing the differences between the arrival time and the transmission time of all groups of request data packets; The minimum value is filtered as the minimum difference between the arrival time and the transmission time of the response data packet by comparing the differences between the arrival time and the transmission time of all groups of response data packets.

[0046] In the embodiment, the correction value is calculated based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, including: The minimum difference between the arrival time and the transmission time of the request data packet is obtained, and the minimum difference between the arrival time and the transmission time of the response data packet is obtained; The correction value is calculated according to the difference between the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, and the specific formula is as follows: θ=(min_D_res-min_D_req) / 2 In the formula, θ represents the correction value; min_D_req represents the minimum difference between the arrival time and the transmission time of the request data packet; and min_D_res represents the minimum difference between the arrival time and the transmission time of the response data packet.

[0047] In the embodiment, the local clock is adjusted by the client according to the correction value, including: According to the calculated correction value, the client adjusts the local clock to synchronize with the server time, wherein: If the theta is greater than 0, the client adjusts the local clock forward by the theta; If the theta is less than 0, the client adjusts the local clock backward by the theta.

[0048] As Figure 5 shown, the embodiment also provides a network time protocol optimization system for asymmetric channel, comprising: a receiving module, configured to continuously acquire response data packets sent by a server until a preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by a client to the server; a screening module, configured to screen the minimum difference between the arrival time and the transmission time of the request data packets from the differences between the arrival time and the transmission time of all groups of request data packets; and screen the minimum difference between the arrival time and the transmission time of the response data packets from the differences between the arrival time and the transmission time of all groups of response data packets; wherein the difference between the arrival time and the transmission time of the request data packets is calculated based on the transmission time of the request data packets and the arrival time of the request data packets; the difference between the arrival time and the transmission time of the response data packets is calculated based on the transmission time of the response data packets and the arrival time of the response data packets; and a time correction module, configured to calculate a correction value based on the minimum difference between the arrival time and the transmission time of the request data packets and the minimum difference between the arrival time and the transmission time of the response data packets, so that the client adjusts the local clock according to the correction value.

[0049] The application also provides a network time protocol optimization device for asymmetric channel, comprising: a memory, configured to store a computer program; and a processor, configured to execute the computer program to realize the steps of the network time protocol optimization method for asymmetric channel.

[0050] The processor implements the steps of the above asymmetric channel-oriented network time protocol optimization when executing the computer program, for example: continuously obtaining the response data packets sent by the server until a preset group number is reached; each group of response data packets corresponds to each group of request data packets sent by the client to the server; among the differences between the arrival times and transmission times of all groups of request data packets, the minimum difference between the arrival time and the transmission time of the request data packet is screened; among the differences between the arrival times and transmission times of all groups of response data packets, the minimum difference between the arrival time and the transmission time of the response data packet is screened; the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; a correction value is calculated based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the client adjusts the local clock according to the correction value.

[0051] Alternatively, the processor implements the functions of the modules in the above system when executing the computer program, for example: a receiving module for continuously obtaining the response data packets sent by the server until a preset group number is reached; each group of response data packets corresponds to each group of request data packets sent by the client to the server; a screening module for screening the minimum difference between the arrival time and the transmission time of the request data packet among the differences between the arrival times and transmission times of all groups of request data packets; screening the minimum difference between the arrival time and the transmission time of the response data packet among the differences between the arrival times and transmission times of all groups of response data packets; the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; a time correction module for calculating a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the client adjusts the local clock according to the correction value.

[0052] Exemplarily, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing preset functions, which are used to describe the execution process of the computer program in the network time protocol optimization device facing asymmetric channel. For example, the computer program can be divided into a receiving module, a screening module and a time correction module; the specific functions of each module are as follows: the receiving module is used for continuously obtaining the response data packets sent by the server side until a preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by the client to the server side; the screening module is used for screening the minimum difference between the arrival time and the transmission time of the request data packet from the difference between the arrival time and the transmission time of all groups of request data packets; screening the minimum difference between the arrival time and the transmission time of the response data packet from the difference between the arrival time and the transmission time of all groups of response data packets; wherein the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; the time correction module is used for calculating a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the client adjusts the local clock according to the correction value.

[0053] The network time protocol optimization device facing asymmetric channel can be a computing device such as a desktop computer, a notebook computer, a palm computer and a cloud server. The network time protocol optimization device facing asymmetric channel can include, but is not limited to, a processor, a memory. Those skilled in the art can understand that the above is an example of the network time protocol optimization device facing asymmetric channel, and does not constitute a limitation on the network time protocol optimization device facing asymmetric channel, and can include more components than the above, or combine certain components, or different components, for example, the network time protocol optimization device facing asymmetric channel can also include an input / output device, a network access device, a bus, etc.

[0054] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor or the like, which is a control center of the network time protocol optimization facing asymmetric channel, and connects various parts of the network time protocol optimization facing asymmetric channel device through various interfaces and lines.

[0055] The memory can be used to store the computer program and / or modules, and the processor realizes various functions of the network time protocol optimization facing asymmetric channel device by running or executing the computer program and / or modules stored in the memory, and calling the data stored in the memory.

[0056] The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; and the data storage area can store data created according to use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, for example, a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state memory devices.

[0057] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the network time protocol optimization facing asymmetric channel method.

[0058] If the modules / units of the network time protocol optimization facing asymmetric channel system are realized in the form of software function units and sold or used as independent products, the modules / units can be stored in a computer readable storage medium.

[0059] Based on such understanding, all or part of the processes in the network time protocol optimization method for asymmetric channel are implemented by the present application, and the computer program can also instruct the relevant hardware to complete. The computer program can be stored in a computer readable storage medium, and the computer program can implement the steps of the network time protocol optimization method for asymmetric channel when executed by a processor. The computer program includes computer program codes in the form of source code, object code, executable files or preset intermediate forms.

[0060] The computer readable storage medium can include any entity or device, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. that can carry the computer program code.

[0061] It should be noted that the content contained in the computer readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable storage medium does not include electrical carrier signals and telecommunication signals.

[0062] The present application provides a network time protocol optimization method for asymmetric channel and related devices, which has the following advantages compared with the existing time synchronization method. The optimization method continuously transmits and receives multiple groups of request and response data packets, respectively screens the minimum value of the difference between the data packet arrival time and the transmission time on the request path and the response path, calculates the clock correction value according to the minimum value, and finally adjusts the local clock according to the clock correction value. The method effectively overcomes the influence of network channel asymmetry (such as the difference in uplink and downlink path delay) on the clock synchronization accuracy, captures the sample closest to the real propagation delay by screening the minimum difference in multiple groups of data, significantly reduces the synchronization error introduced by random network jitter and queuing delay, thereby greatly improving the time synchronization accuracy of the client and the server in the asymmetric network environment, and all operations are completed on the client without the need to modify the server, which has good deployment convenience.

[0063] The above embodiments are only one of the implementation manners of the technical solutions of the present application, and the scope of protection of the present application is not limited to the above embodiments, but also includes any changes, substitutions and other implementation manners easily thought of by those skilled in the art within the technical scope disclosed by the present application.

[0064] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application but not to limit it. Although the present application has been described in detail with reference to the above embodiments, it should be understood by those skilled in the art that the specific embodiments of the present application can be modified or equivalently replaced without departing from the spirit and scope of the present application, and any modification or equivalent replacement should be covered within the protection scope of the present application.

Claims

1. A network time protocol optimization method for asymmetric channel, applied to a client, characterized in that, The method comprises the following steps: continuously acquiring the response data packets sent by the server until a preset group number is reached; each group of response data packets corresponds to each group of request data packets sent by the client to the server; selecting the minimum difference between the arrival time and the transmission time of the request data packet from the differences between the arrival time and the transmission time of all groups of request data packets; selecting the minimum difference between the arrival time and the transmission time of the response data packet from the differences between the arrival time and the transmission time of all groups of response data packets; the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; calculating a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so that the client adjusts the local clock according to the correction value.

2. The network time protocol optimization method for asymmetric channel according to claim 1, wherein, Before the step of continuously acquiring the response data packets sent by the server until a preset group number is reached, the method comprises the following steps: continuously sending multiple groups of request data packets to the server until a preset group number is reached.

3. The method of claim 1, wherein, The step of continuously acquiring the response data packets sent by the server until a preset group number is reached comprises the following steps: continuously receiving the response data packets sent by the server until a preset group number is reached; recording the transmission time and the arrival time of all response data packets.

4. The method of claim 1, wherein, The step of selecting the minimum difference between the arrival time and the transmission time of the request data packet from the differences between the arrival time and the transmission time of all groups of request data packets; Before the step of selecting the minimum difference between the arrival time and the transmission time of the response data packet from the differences between the arrival time and the transmission time of all groups of response data packets, the method comprises the following steps: calculating the difference between the arrival time and the transmission time of each group of request data packets based on the transmission time of each group of request data packets and the arrival time of the request data packet; calculating the difference between the arrival time and the transmission time of each group of response data packets based on the transmission time of each group of response data packets and the arrival time of the response data packet.

5. The method of claim 1, wherein, The step of selecting the minimum difference between the arrival time and the transmission time of the request data packet from the differences between the arrival time and the transmission time of all groups of request data packets; The step of selecting the minimum difference between the arrival time and the transmission time of the response data packet from the differences between the arrival time and the transmission time of all groups of response data packets comprises the following steps: In the differences between the arrival time and the transmission time of all groups of request data packets, comparing the differences between the arrival time and the transmission time of all groups of request data packets, and selecting the minimum value as the minimum difference between the arrival time and the transmission time of the request data packet; In the differences between the arrival time and the transmission time of all groups of response data packets, comparing the differences between the arrival time and the transmission time of all groups of response data packets, and selecting the minimum value as the minimum difference between the arrival time and the transmission time of the response data packet.

6. The method of claim 1, wherein, The step of calculating a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet comprises the following steps: obtaining a minimum difference between the arrival time and the transmission time of the request data packet, and a minimum difference between the arrival time and the transmission time of the response data packet; calculating a correction value according to a difference between the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, and the specific formula is as follows: θ=(min_D_res-min_D_req) / 2 In the formula, θ represents the correction value; min_D_req represents the minimum difference between the arrival time and the transmission time of the request data packet; and min_D_res represents the minimum difference between the arrival time and the transmission time of the response data packet.

7. The method of claim 6, wherein, The client adjusts the local clock according to the correction value, and the adjusting comprises: adjusting the local clock according to the calculated correction value, so as to synchronize with the server time, and the adjusting comprises: if θ>0, adjusting the local clock forward by θ; if θ<0, adjusting the local clock backward by θ.

8. A network time protocol optimization system for asymmetric channels, characterized by, comprise: a receiving module, configured to continuously obtain the response data packets sent by the server until a preset group number is reached; wherein each group of response data packets corresponds to each group of request data packets sent by the client to the server; a screening module, configured to screen a minimum difference between the arrival time and the transmission time of the request data packet from differences between the arrival time and the transmission time of all groups of request data packets, and screen a minimum difference between the arrival time and the transmission time of the response data packet from differences between the arrival time and the transmission time of all groups of response data packets; wherein the difference between the arrival time and the transmission time of the request data packet is calculated based on the transmission time of the request data packet and the arrival time of the request data packet; and the difference between the arrival time and the transmission time of the response data packet is calculated based on the transmission time of the response data packet and the arrival time of the response data packet; a time correction module, configured to calculate a correction value based on the minimum difference between the arrival time and the transmission time of the request data packet and the minimum difference between the arrival time and the transmission time of the response data packet, so as to adjust the local clock according to the correction value by the client.

9. A network time protocol optimization device for asymmetric channels, characterized by comprise: a memory, configured to store a computer program; a processor, configured to execute the computer program to implement the steps of the network time protocol optimization method for an asymmetric channel according to any one of claims 1-7.

10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the steps of the network time protocol optimization method for an asymmetric channel according to any one of claims 1-7.