Clock synchronization method and apparatus, and storage medium

CN115843096BActive Publication Date: 2026-10-20BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211461850.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2026-10-20
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

然而,针对无线局域网络,相关技术尚未提出一种合理有效的时钟同步方案

Benefits of technology

[0027]本公开的实施例提供的技术方案可以包括以下有益效果:本公开可以通过基于第一设备多次向第二设备传输数据时对应的最小传输延时、及第二设备多次向第一设备传输数据时对应的最小传输延时,确定第一设备与第二设备之间的时钟差异,进而将第一设备的时钟与第二设备的时钟调整为同步。其中,由于不同设备之间通过无线局域网环境传输数据受到的传输干扰较小,因此设备间通过无线局域网络传输数据时对应的最小传输延时,可被视为等同无干扰条件下的传输延时。也因此,针对无线局域网络,本公开通过设备间最小传输延时确定时钟差异,可以使不同设备之间保有较高的时钟同步精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115843096B_ABST
    Figure CN115843096B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a clock synchronization method, device and storage medium. The clock synchronization method comprises: determining a clock difference between a first device and a second device, the clock difference being determined based on minimum transmission delays corresponding to multiple times of data transmission from the first device to the second device and minimum transmission delays corresponding to multiple times of data transmission from the second device to the first device; and adjusting clocks of the first device and the second device to be synchronized based on the clock difference. Through the present disclosure, the clocks between devices can be adjusted to be synchronized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of communication technology, and in particular to a clock synchronization method, apparatus and storage medium. Background Technology

[0002] With the development of communication technology, the number of devices in network environments such as home networks and industrial networks is increasing. Typically, for multiple devices in the same network environment, inter-device collaboration requires high-precision clock synchronization. For example, for distributed devices, the clocks of different devices need to be synchronized to ensure the synchronicity of distributed device operations, the atomicity of distributed data operations, and the high efficiency of time-sharing multiplexing of distributed resources.

[0003] In related technologies, solutions for inter-device clock synchronization have been proposed based on the applicability to different networks, including wired and wireless wide area networks. However, for wireless local area networks, no reasonable and effective clock synchronization solution has yet been proposed. Summary of the Invention

[0004] To overcome the problems existing in related technologies, this disclosure provides a clock synchronization method, apparatus and storage medium.

[0005] According to a first aspect of the present disclosure, a clock synchronization method is provided, comprising: Determine the clock difference between the first device and the second device, the clock difference being based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times; based on the clock difference, adjust the clocks of the first device and the second device to be synchronized.

[0006] In one embodiment, determining the clock difference between the first device and the second device includes: obtaining a correspondence between the clock values ​​of the first device and the clock values ​​of the second device, wherein the correspondence is determined based on the minimum transmission delay corresponding to multiple data transmissions from the first device to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device; and determining the clock difference between the first device and the second device based on the correspondence between the clock values ​​of the first device and the clock values ​​of the second device.

[0007] In one embodiment, the correspondence between the clock values ​​of the first device and the second device is predetermined in the following manner: determining a first delay, which is the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device, and the first delay is determined based on a first transmission time recorded by the first device and a first reception time recorded by the second device; and determining a second delay, which is the minimum transmission delay corresponding to multiple second transmissions from the second device to the first device, and the second delay is determined based on a second transmission time recorded by the second device and a second reception time recorded by the first device; and determining the correspondence between the clock values ​​of the first device and the second device based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time.

[0008] In one embodiment, determining the correspondence between the clock values ​​of the first device and the clock values ​​of the second device based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time includes: obtaining a pre-configured first coefficient; determining a second coefficient based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time; and obtaining a fitted straight line characterizing the correspondence based on the first coefficient and the second coefficient; wherein, in the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device.

[0009] In one embodiment, the second coefficient is calculated using the following formula: Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

[0010] In one embodiment, the fitted straight line is expressed by the following formula: Among them, t m t is the clock value of the second device. s Let 'a' be the clock value of the first device, and 'a' be the first coefficient. This is the second coefficient.

[0011] In one embodiment, the method further includes: determining a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time; wherein the third transmission time and the fourth reception time are recorded by the first device, the third reception time and the fourth transmission time are recorded by the second device, the difference between the third transmission time and the third reception time represents the minimum transmission delay corresponding to multiple third transmissions from the first device to the second device, and the difference between the fourth transmission time and the fourth reception time represents the minimum transmission delay corresponding to multiple fourth transmissions from the first device to the second device; determining a third coefficient and a fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time; updating the first coefficient according to the third coefficient, and updating the second coefficient according to the fourth coefficient.

[0012] In one embodiment, determining a third coefficient and a fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time includes: determining a first correlation and a second correlation based on the fitted straight line; wherein the first correlation is the correlation between the first transmission time, the first reception time, the second transmission time, the second reception time, the third coefficient, and the fourth coefficient, and the second correlation is the correlation between the third transmission time, the third reception time, the fourth transmission time, the fourth reception time, the third coefficient, and the fourth coefficient; and determining the third coefficient and the fourth coefficient based on the first correlation and the second correlation.

[0013] In one embodiment, the method further includes: determining that a specified time meets preset filtering conditions before determining the specified coefficient; wherein the specified coefficient includes a first coefficient and a second coefficient, and the specified time includes a first sending time, a first receiving time, a second sending time, and a second receiving time; or the specified coefficient includes a third coefficient and a fourth coefficient, and the specified time includes a third sending time, a third receiving time, a fourth sending time, and a fourth receiving time.

[0014] In one implementation, the preset filtering conditions include: in, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. The adjustable coefficient is the... The value increases as the number of times the specified time does not meet the preset filtering conditions increases; t1 is the first sending time, t2 is the first receiving time, t3 is the second sending time, and t4 is the second receiving time; or t1 is the third sending time, t2 is the third receiving time, t3 is the fourth sending time, and t4 is the fourth receiving time.

[0015] According to a second aspect of the present disclosure, a clock synchronization device is provided, comprising: A determining unit is configured to determine the clock difference between a first device and a second device, the clock difference being determined based on the minimum transmission delay corresponding to multiple data transmissions from the first device to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device; a processing unit is configured to adjust the clocks of the first device and the second device to be synchronized based on the clock difference.

[0016] In one embodiment, the determining unit determines the clock difference between the first device and the second device in the following manner: obtaining the correspondence between the clock value of the first device and the clock value of the second device, the correspondence being determined based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times; and determining the clock difference between the first device and the second device based on the correspondence between the clock values ​​of the first device and the second device.

[0017] In one embodiment, the determining unit predetermines the correspondence between the clock values ​​of the first device and the second device in the following manner: determining a first delay, which is the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device, and the first delay is determined based on a first transmission time recorded by the first device and a first reception time recorded by the second device; and determining a second delay, which is the minimum transmission delay corresponding to multiple second transmissions from the second device to the first device, and the second delay is determined based on a second transmission time recorded by the second device and a second reception time recorded by the first device; and determining the correspondence between the clock values ​​of the first device and the second device based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time.

[0018] In one embodiment, the determining unit determines the correspondence between the clock values ​​of the first device and the clock values ​​of the second device based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time in the following manner: obtaining a pre-configured first coefficient; determining a second coefficient based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time; and obtaining a fitted straight line characterizing the correspondence based on the first coefficient and the second coefficient; wherein, in the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device.

[0019] In one embodiment, the determining unit calculates the second coefficient using the following formula: Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

[0020] In one embodiment, the fitted straight line is expressed by the following formula: Among them, t m t is the clock value of the second device. s Let be the clock value of the first device, 'a' be the first coefficient, and 'offset' be the second coefficient.

[0021] In one embodiment, the determining unit is further configured to: determine a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time; wherein the third transmission time and the fourth reception time are recorded by the first device, the third reception time and the fourth transmission time are recorded by the second device, the difference between the third transmission time and the third reception time represents the minimum transmission delay corresponding to multiple third transmissions from the first device to the second device, and the difference between the fourth transmission time and the fourth reception time represents the minimum transmission delay corresponding to multiple fourth transmissions from the first device to the second device; determine a third coefficient and a fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time; update the first coefficient according to the third coefficient, and update the second coefficient according to the fourth coefficient.

[0022] In one embodiment, the determining unit determines the third coefficient and the fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time in the following manner: Based on the fitted straight line, a first correlation and a second correlation are determined; wherein the first correlation is the correlation between the first transmission time, the first reception time, the second transmission time, the second reception time, the third coefficient, and the fourth coefficient, and the second correlation is the correlation between the third transmission time, the third reception time, the fourth transmission time, the fourth reception time, the third coefficient, and the fourth coefficient; based on the first correlation and the second correlation, the third coefficient and the fourth coefficient are determined.

[0023] In one embodiment, the determining unit is further configured to: determine that a specified time meets preset filtering conditions before determining the specified coefficient; wherein the specified coefficient includes a first coefficient and a second coefficient, and the specified time includes a first sending time, a first receiving time, a second sending time, and a second receiving time; or the specified coefficient includes a third coefficient and a fourth coefficient, and the specified time includes a third sending time, a third receiving time, a fourth sending time, and a fourth receiving time.

[0024] In one implementation, the preset screening conditions include: in, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. The adjustable coefficient is the... The value increases as the number of times the specified time does not meet the preset filtering conditions increases; t1 is the first sending time, t2 is the first receiving time, t3 is the second sending time, and t4 is the second receiving time; or t1 is the third sending time, t2 is the third receiving time, t3 is the fourth sending time, and t4 is the fourth receiving time.

[0025] According to a third aspect of the present disclosure, a clock synchronization device is provided, comprising: Processor; memory used to store processor-executable instructions; The processor is configured to execute the clock synchronization method described in the first aspect or any embodiment of the first aspect.

[0026] According to a fourth aspect of the present disclosure, a storage medium is provided, the storage medium storing instructions that, when executed by a processor, enable the processor to perform the clock synchronization method described in the first aspect or any embodiment of the first aspect.

[0027] The technical solutions provided by the embodiments of this disclosure can include the following beneficial effects: This disclosure can determine the clock difference between the first device and the second device based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times, thereby synchronizing the clocks of the first device and the second device. Since the transmission interference between different devices is relatively small when transmitting data through a wireless local area network (WLAN), the minimum transmission delay corresponding to the data transmission between devices through the WLAN can be considered equivalent to the transmission delay under interference-free conditions. Therefore, for WLANs, this disclosure, by determining the clock difference through the minimum transmission delay between devices, can maintain high clock synchronization accuracy between different devices.

[0028] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0029] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0030] Figure 1 This is a flowchart illustrating a clock synchronization method according to an exemplary embodiment.

[0031] Figure 2 This is a flowchart illustrating a method for determining the clock difference between a first device and a second device according to an exemplary embodiment.

[0032] Figure 3 This is a flowchart illustrating a method for determining the correspondence between the clock values ​​of a first device and the clock values ​​of a second device, according to an exemplary embodiment.

[0033] Figure 4 This is a flowchart illustrating a method for obtaining a fitted straight line according to an exemplary embodiment.

[0034] Figure 5 This is a flowchart illustrating a method for updating a first coefficient and a second coefficient according to an exemplary embodiment.

[0035] Figure 6 This is a flowchart illustrating a method for determining a third coefficient and a fourth coefficient according to an exemplary embodiment.

[0036] Figure 7 This is a flowchart illustrating another method for obtaining a fitted straight line according to an exemplary embodiment.

[0037] Figure 8This is a block diagram illustrating a clock synchronization device according to an exemplary embodiment.

[0038] Figure 9 This is a block diagram illustrating an apparatus for a clock synchronization method according to an exemplary embodiment. Detailed Implementation

[0039] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure.

[0040] In the accompanying drawings, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The described embodiments are some, but not all, of the embodiments of this disclosure. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure. The embodiments of this disclosure will be described in detail below with reference to the accompanying drawings.

[0041] The clock synchronization method provided in this disclosure can be applied to scenarios where the clocks of different devices need to be synchronized. For example, it can be used to synchronize the clocks of a master device and a slave device in a distributed system.

[0042] With the development of communication technology, the number of devices in network environments such as home networks and industrial networks is increasing. Typically, for multiple devices in the same network environment, inter-device collaboration requires high-precision clock synchronization. For example, for distributed devices, the clocks of different devices need to be synchronized to ensure the synchronicity of distributed device operations, the atomicity of distributed data operations, and the high efficiency of time-sharing multiplexing of distributed resources.

[0043] In related technologies, solutions for inter-device clock synchronization have been proposed based on the applicability to different networks, enabling synchronization in both wired and wireless wide area networks (WANs). Wired network clock synchronization solutions, such as protocols like IEEE 1588v2 and 802.1AS, are designed for situations where wired network transmission delays are relatively fixed. For example, taking master-slave device clock synchronization via the IEEE 1588v2 protocol as an example, the master clock periodically publishes a point-to-point (PTP) time synchronization protocol and time information. The system receives timestamp information from the master clock port and calculates the master-slave line time delay and the clock difference between the master and slave devices, thus synchronizing the devices. Since transmission delays are typically variable in wireless local area networks (WLANs), wired network clock synchronization solutions are not suitable for WLANs. Wireless wide area network (WAN) clock synchronization solutions include, for example, the Network Time Protocol (NTP). Taking clock synchronization between master and slave devices via the NTP protocol as an example, clock synchronization requires a time server to transmit the synchronization clock source level by level to the root node, i.e., the master and slave devices. Due to network latency and filtering, clock synchronization schemes for wireless wide area networks (WANs) have relatively low synchronization accuracy and a complex overall architecture, making them unsuitable for implementation in relatively simple wireless local area networks (WLANs). In summary, no clock synchronization scheme with high accuracy that can be applied to WLANs has yet been proposed in the relevant technologies.

[0044] In view of this, this disclosure provides a clock synchronization method. This method determines the clock difference between the master and slave devices based on the minimum transmission delay corresponding to multiple data transmissions from the master device to the slave device, and the minimum transmission delay corresponding to multiple data transmissions from the slave device to the master device, thereby synchronizing the clocks of the master and slave devices. Since the transmission interference between different devices in a wireless LAN environment is relatively small, the minimum transmission delay corresponding to data transmission between devices through a wireless LAN can be considered equivalent to the transmission delay under interference-free conditions. Therefore, for wireless LANs, this disclosure determines the clock difference by using the minimum transmission delay between devices, which can maintain high clock synchronization accuracy between different devices.

[0045] For ease of description, the different devices to be synchronized by clock are referred to as the first device and the second device, respectively. Taking a distributed device as an example, the first device can be a slave device, and the second device can be a master device. Alternatively, the first device can be the master device, and the second device can be a slave device.

[0046] Figure 1This is a flowchart illustrating a clock synchronization method according to an exemplary embodiment, such as... Figure 1 As shown, it includes the following steps S11 and S12.

[0047] In step S11, the clock difference between the first device and the second device is determined.

[0048] In this embodiment of the disclosure, the clock difference can be determined based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times. Furthermore, since this embodiment of the disclosure involves data transmission between the first and second devices to determine the transmission delay generated during the transmission process, this disclosure does not specifically limit the data transmitted.

[0049] In step S12, the clock of the first device is synchronized with the clock of the second device based on the clock difference.

[0050] The method provided in this disclosure can provide a feasible and effective clock synchronization scheme for distributed devices that communicate using wireless local area networks.

[0051] It is worth noting that steps S11 and S12 in the above embodiments can be performed by the first device, the second device, or other devices besides the first and second devices. Taking the first device performing steps S11 and S12 as an example, the first device can determine the clock difference between itself and the second device by the minimum transmission delay corresponding to multiple data transmissions to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device. Then, it can adjust its own clock value according to the clock difference to synchronize its own clock with the clock of the second device. In addition, the implementation method of the second device or the aforementioned other devices performing steps S11 and S12 is similar to the implementation method of the first device performing steps S11 and S12, and will not be described in detail here.

[0052] As a feasible implementation method, the correspondence between the clock value of the first device and the clock value of the second device can be determined, and then the clock difference between the first device and the second device can be determined based on the correspondence.

[0053] Figure 2 This is a flowchart illustrating a method for determining the clock difference between a first device and a second device according to an exemplary embodiment, as shown below. Figure 2 As shown, it includes the following steps.

[0054] In step S21, the correspondence between the clock value of the first device and the clock value of the second device is obtained.

[0055] The correspondence between the clock values ​​of the first device and the second device can be predetermined based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times.

[0056] In step S22, the clock difference between the first device and the second device is determined based on the correspondence between the clock values ​​of the first device and the second device.

[0057] The method provided in this disclosure can determine the clock difference between the first device and the second device by the correspondence between the clock values ​​of the first device and the clock values ​​of the second device.

[0058] For example, taking the adjustment of its own clock value by the first device as an example, the clock of the first device is synchronized with the clock of the second device. For instance, the first device can determine the current clock value of the second device corresponding to its current clock value based on the correspondence between its own clock value and the clock values ​​of the second device. Based on this, the first device can adjust its own clock value from its current clock value to the current clock value of the second device, so that the clocks of the first device and the second device are synchronized.

[0059] It should be noted that, in order to determine the correspondence between the clock values ​​of the first device and the second device, multiple batches of data transmission are required between the first and second devices. For each batch of data transmission, both the first and second devices need to perform multiple transmissions. For ease of description, the first batch of transmissions from the first device to the second device will be referred to as the first transmission, and the first batch of transmissions from the second device to the first device will be referred to as the second transmission. Correspondingly, the subsequent batches of transmissions from the first device to the second device will be referred to as the third transmission, and the subsequent batches of transmissions from the second device to the first device will be referred to as the fourth transmission.

[0060] As a feasible implementation method, the correspondence between the clock value of the first device and the clock value of the second device can be determined through the first transmission and the second transmission.

[0061] For ease of description, the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device is referred to as the first delay, and the minimum transmission delay corresponding to multiple second transmissions from the second device to the first device is referred to as the second delay. Furthermore, the sending time and receiving time used to determine the first delay are respectively referred to as the first sending time and the first receiving time, and the sending time and receiving time used to determine the second delay are respectively referred to as the second sending time and the second receiving time.

[0062] Figure 3This is a flowchart illustrating a method for determining the correspondence between the clock values ​​of a first device and the clock values ​​of a second device, according to an exemplary embodiment. Figure 3 As shown, it includes the following steps S31 and S32.

[0063] In step S31, the first delay and the second delay are determined.

[0064] The first transmission time and the second reception time are recorded by the first device, and the second transmission time and the first reception time are recorded by the second device.

[0065] In step S32, the correspondence between the clock value of the first device and the clock value of the second device is determined based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time.

[0066] The method provided in this disclosure can determine the correspondence between the clock value of the first device and the clock value of the second device by using the minimum transmission delay between the first device and the second device, and the transmit and receive times used to determine the minimum transmission delay.

[0067] For example, as a feasible implementation, a fitted straight line can be constructed, and the fitted straight line can be used to characterize the correspondence between the clock values ​​of the first device and the clock values ​​of the second device. For ease of description, the slope coefficient of the fitted straight line will be referred to as the first coefficient, and the intercept coefficient of the fitted straight line will be referred to as the second coefficient.

[0068] Figure 4 This is a flowchart illustrating a method for obtaining a fitted straight line according to an exemplary embodiment, such as... Figure 4 As shown, it includes the following steps.

[0069] In step S41, the pre-configured first coefficient is obtained.

[0070] For example, the first coefficient can be configured to be 1 by default.

[0071] In step S42, a second coefficient is determined based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time.

[0072] It is understood that there is no fixed execution order between steps S41 and S42. For example, step S42 can be executed first and then step S41, or steps S41 and S42 can be executed simultaneously.

[0073] In step S43, a fitted straight line representing the corresponding relationship is obtained based on the first coefficient and the second coefficient.

[0074] In this embodiment of the disclosure, a fitted straight line can be constructed, and the fitted straight line can be used to characterize the correspondence between the clock values ​​of the first device and the clock values ​​of the second device. Specifically, for the first coefficient and the second coefficient in the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device.

[0075] For example, as a feasible implementation, it can be achieved through... The second coefficient is obtained. Here, offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

[0076] For ease of understanding, the derivation process of the second coefficient is illustrated below.

[0077] For example, when data is transmitted through a transmission medium, the transmission delay will vary depending on factors such as device performance, transmission protocol, and transmission medium, resulting in multiple one-way transmissions between two devices. Therefore, in this embodiment, the data transmission delay is defined as including both a fixed delay and a non-fixed delay. The fixed delay can be understood as the minimum transmission delay corresponding to one-way transmission between devices under ideal conditions, while the non-fixed delay can be understood as the additional transmission delay caused by interference during actual transmission, beyond the minimum transmission delay.

[0078] Based on this, taking the first transmission time, the first reception time, the second transmission time, and the second reception time as examples, it can be achieved through... or through This expresses the correspondence between the clock values ​​of the first device and the clock values ​​of the second device. Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. This can be understood as the fixed delay corresponding to the transmission from the first device to the second device. This can be understood as the fixed delay corresponding to the transmission from the second device to the first device. This can be understood as the non-fixed delay corresponding to the transmission from the first device to the second device. This can be understood as the fixed delay corresponding to the transmission from the second device to the first device, which represents the non-fixed delay portion.

[0079] Furthermore, due to the symmetry of the transmission medium, the fixed delay corresponding to the transmission from the first device to the second device is equal to the fixed delay corresponding to the transmission from the second device to the first device. At this point, it can be accessed via... Express the second coefficient. For example, to obtain a second coefficient with higher precision, it is necessary to satisfy the following condition: and As equal as possible. Furthermore, based on experimental results, it can be concluded that... and The smaller, and The closer the values ​​are, the better. Therefore, as a preferred approach, the selected transmission delay should guarantee... The smaller the value, the better. Therefore, in the above embodiments, the minimum transmission delay corresponding to the transmission between the first device and the second device is used to determine the second coefficient.

[0080] In addition, it can be achieved through Expressing the first delay, and through This expresses the second delay. Among them, This can be understood as the deviation between the first delay and the fixed delay. This can be understood as the deviation between the second delay and the fixed delay. Based on this, it can be adjusted accordingly. Express the second coefficient. Furthermore, since the first delay is the minimum transmission delay corresponding to the first transmission, and the second delay is the minimum transmission delay corresponding to the second transmission, therefore, and It can be considered approximately 0. Therefore, the second coefficient can ultimately be obtained through... This is represented as follows: where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

[0081] Since the clock values ​​of the first device and the second device increase at synchronized rates, for example, the pre-configured first coefficient can be 1.

[0082] In this embodiment of the disclosure, it can be achieved through... Express the fitted straight line. Where t m t is the clock value of the second device. s Let 'a' be the clock value of the first device, and 'a' be the first coefficient. This is the second coefficient. Furthermore, taking an example where the first coefficient is 1 and the second coefficient is offset, it can be achieved through... Express the fitted straight line.

[0083] The method provided in this disclosure, in addition to the initial transmissions including the first and second transmissions mentioned above, also includes non-initial transmissions including the third and fourth transmissions. As a feasible implementation, the first and second coefficients in the fitted straight line can be updated through the third and fourth transmissions to further improve the accuracy of the fitted straight line.

[0084] For ease of description, the coefficient used to update the first coefficient is referred to as the third coefficient, and the coefficient used to update the second coefficient is referred to as the fourth coefficient. Furthermore, the specific transmission time recorded by the first device when the first device makes multiple third transmissions to the second device is referred to as the third transmission time; the specific reception time recorded by the second device when the first device makes multiple third transmissions to the second device is referred to as the third reception time; the specific reception time recorded by the first device when the second device makes multiple fourth transmissions to the first device is referred to as the fourth reception time; and the specific transmission time recorded by the second device when the second device makes multiple fourth transmissions to the first device is referred to as the fourth transmission time.

[0085] The difference between the third transmission time and the third reception time represents the minimum transmission delay when the first device makes multiple third transmissions to the second device, and the difference between the fourth transmission time and the fourth reception time represents the minimum transmission delay when the first device makes multiple fourth transmissions to the second device.

[0086] For example, the first and second coefficients in the fitted line can be updated in the following way.

[0087] Figure 5 This is a flowchart illustrating a method for updating a first coefficient and a second coefficient according to an exemplary embodiment, such as... Figure 5 As shown, it includes the following steps.

[0088] In step S51, the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time are determined.

[0089] In step S52, the third coefficient and the fourth coefficient are determined based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time.

[0090] In step S53, the first coefficient is updated according to the third coefficient, and the second coefficient is updated according to the fourth coefficient.

[0091] The method provided in this disclosure can obtain the minimum transmission delay for data transmission between a first device and a second device through the first batch of data transmission, and use this delay to determine a fitted straight line that characterizes the correspondence between the clocks of the first device and the second device. Furthermore, a new minimum transmission delay can be obtained through subsequent batches of data transmission to update the first and second coefficients in the fitted straight line. This method further improves the accuracy of the fitted straight line by enriching the data samples, enabling more precise clock synchronization between the first and second devices.

[0092] For example, the third and fourth coefficients can be determined in the following manner. For ease of description, this disclosure refers to the relationship between the first transmission time, the first reception time, the second transmission time, the second reception time, the third coefficient, and the fourth coefficient as the first relationship, and the relationship between the third transmission time, the third reception time, the fourth transmission time, the fourth reception time, the third coefficient, and the fourth coefficient as the second relationship.

[0093] Figure 6 This is a flowchart illustrating a method for determining a third and a fourth coefficient according to an exemplary embodiment, such as... Figure 6 As shown, it includes the following steps.

[0094] In step S61, the first correlation relationship and the second correlation relationship are determined based on the fitted straight line.

[0095] In step S62, the third and fourth coefficients are determined based on the first and second association relationships.

[0096] In this embodiment of the disclosure, the first correlation relationship and the second correlation relationship can be determined by fitting a straight line. Taking the first correlation relationship as an example, it can be determined in the following manner.

[0097] For example, taking the first device as the slave device and the second device as the master device, it can be done through... The method used is to determine the master timestamp corresponding to the second reception time in the master device. Among these methods, This is the master timestamp corresponding to the second receiving time. For the second receiving time, 'a' is the first coefficient and 'b' is the second coefficient. Correspondingly, it can be achieved through... This method determines the master timestamp corresponding to the first transmission time in the master device. Among other things, This is the master timestamp corresponding to the first transmission time. The first transmission time is denoted as 'a', where 'a' is the first coefficient and 'b' is the second coefficient.

[0098] Based on this, the first delay after clock synchronization can be further estimated as follows: The second delay after clock synchronization can be estimated as .in, This indicates the first delay after clock synchronization. Indicates the first receiving time. The primary timestamp represents the first time the message was sent. This indicates the second delay after clock synchronization. Indicates the second transmission time. This represents the main timestamp of the second receiving time.

[0099] In one implementation, the third and fourth coefficients can be determined using a confidence parameter. For example, by... Corrections are needed. Specifically, Here, is the confidence level parameter, and `delay` is the average value between the first and second delays. This can be achieved through... The confidence parameter (represented by k) is determined in this way. This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. This is an adjustable coefficient. Let $\frac{1}{2}$ be the minimum transmission delay for each of the multiple data transmissions from the first device to the second device. For the first transmission... This is the first delay.

[0100] The method provided in this disclosure allows for the derivation of a fitting point on the fitted line, i.e. Furthermore, if the third coefficient is used as the updated first coefficient, and the fourth coefficient is used as the updated second coefficient, then the updated fitted line can be expressed as: .in, This represents the third coefficient, which is the updated first coefficient. This represents the fourth coefficient, which is the updated second coefficient.

[0101] Based on this, substituting the fitted points obtained above into the updated fitted line, we can obtain the first correlation relationship, namely... Where a represents the first coefficient and b represents the second coefficient. Indicates the third coefficient. Let t1 represent the first transmission time, t2 the first reception time, t3 the second transmission time, and t4 the second reception time. It is evident that in the first correlation, all coefficients except the third and fourth are known quantities. In other words, the first correlation represents a set of correspondences between the third and fourth coefficients. Correspondingly, the second correlation can be obtained in a similar manner to determine another set of correspondences between the third and fourth coefficients. Thus, the third coefficient and the fourth coefficient can be determined through these two sets of correspondences.

[0102] The clock synchronization method provided in this disclosure can filter the delayed data recorded in each batch using pre-configured filtering conditions.

[0103] For example, before specifying a coefficient, it can be determined whether a specified time meets preset filtering conditions. The specified coefficients include a first coefficient and a second coefficient, and the specified times include a first transmission time, a first reception time, a second transmission time, and a second reception time. Alternatively, the specified coefficients include a third coefficient and a fourth coefficient, and the specified times include a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time.

[0104] For example, if the specified coefficients include the first coefficient and the second coefficient, and the specified time includes the first transmission time, the first reception time, the second transmission time, and the second reception time, the filtering can be performed in the following way.

[0105] Figure 7 This is a flowchart illustrating another method for obtaining a fitted straight line according to an exemplary embodiment, such as... Figure 7 As shown, it includes the following steps.

[0106] In step S71, if the first transmission time, the first reception time, the second transmission time, and the second reception time meet the preset filtering conditions, the pre-configured first coefficient is obtained.

[0107] In step S72, a second coefficient is determined based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time.

[0108] Example, configurable The preset filtering criteria. Among them, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. This is an adjustable coefficient. The value increases as the number of times the preset filtering conditions are not met at a specified time increases. Furthermore, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. Alternatively, t1 is the third transmission time, t2 is the third reception time, t3 is the fourth transmission time, and t4 is the fourth reception time.

[0109] The clock synchronization method provided in this disclosure offers a clock synchronization scheme suitable for wireless local area networks. This method has no hardware requirements; clock synchronization can be completed simply by connecting to the network, resulting in low hardware costs. Furthermore, the clock synchronization method provided in this disclosure selects the minimum transmission delay to determine the clock difference, which can reduce the impact of interference factors during wireless transmission on clock synchronization. In addition, during the process of determining the clock difference by fitting a straight line, multiple fitting and corrections are performed to maintain high accuracy in clock synchronization. Moreover, this disclosure further filters the minimum transmission delay through preset screening conditions, further ensuring the accuracy of clock synchronization. Simultaneously, the adjustable coefficient in the preset screening conditions... The granularity of the filtering can be increased as the number of times the preset filtering conditions are not met at a specified time increases, so as to adjust the filtering granularity in a timely manner when the wireless network status is unstable, ensuring the correctness of the clock synchronization results. In addition, since the clock synchronization method provided in this disclosure is based on transmission delay, the method is applicable to wireless local area networks and is also compatible with wired networks.

[0110] Based on the same concept, embodiments of this disclosure also provide a clock synchronization device.

[0111] It is understood that the clock synchronization device provided in this disclosure includes hardware structures and / or software modules corresponding to each function in order to achieve the above-mentioned functions. In conjunction with the units and algorithm steps of the various examples disclosed in this disclosure, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of this disclosure.

[0112] Figure 8 This is a block diagram illustrating a clock synchronization device according to an exemplary embodiment. (Refer to...) Figure 8 The device 100 includes a determining unit 101 and a processing unit 102.

[0113] The determining unit 101 is used to determine the clock difference between the first device and the second device. The clock difference is determined based on the minimum transmission delay corresponding to multiple data transmissions from the first device to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device. The processing unit is used to synchronize the clocks of the first device and the second device based on the clock difference.

[0114] In one embodiment, the determining unit 101 determines the clock difference between the first device and the second device in the following manner: It obtains the correspondence between the clock values ​​of the first device and the second device, the correspondence being determined based on the minimum transmission delay corresponding to multiple data transmissions from the first device to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device. Based on the correspondence between the clock values ​​of the first device and the second device, the clock difference between the first device and the second device is determined.

[0115] In one embodiment, the determining unit 101 pre-determines the correspondence between the clock values ​​of the first device and the second device in the following manner: determining a first delay, which is the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device, and the first delay is determined based on the first transmission time recorded by the first device and the first reception time recorded by the second device; and determining a second delay, which is the minimum transmission delay corresponding to multiple second transmissions from the second device to the first device, and the second delay is determined based on the second transmission time recorded by the second device and the second reception time recorded by the first device. Based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time, the correspondence between the clock values ​​of the first device and the second device is determined.

[0116] In one embodiment, the determining unit 101 determines the correspondence between the clock values ​​of the first device and the clock values ​​of the second device based on a first delay, a second delay, a first transmission time, a first reception time, a second transmission time, and a second reception time as follows: A pre-configured first coefficient is obtained. A second coefficient is determined based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time. A fitted straight line representing the correspondence is obtained based on the first and second coefficients. In the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device.

[0117] In one embodiment, the determining unit 101 calculates the second coefficient using the following formula: Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

[0118] In one implementation, the pre-configured first coefficient is 1.

[0119] In one implementation, the fitted straight line is expressed by the following formula: Among them, t m t is the clock value of the second device. s Let 'a' be the clock value of the first device, and 'a' be the first coefficient. This is the second coefficient.

[0120] In one embodiment, the determining unit 101 is further configured to: determine a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time. The third transmission time and the fourth reception time are recorded by a first device, and the third reception time and the fourth transmission time are recorded by a second device. The difference between the third transmission time and the third reception time represents the minimum transmission delay corresponding to multiple third transmissions from the first device to the second device, and the difference between the fourth transmission time and the fourth reception time represents the minimum transmission delay corresponding to multiple fourth transmissions from the first device to the second device. Based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time, a third coefficient and a fourth coefficient are determined. The first coefficient is updated according to the third coefficient, and the second coefficient is updated according to the fourth coefficient.

[0121] In one embodiment, the determining unit 101 determines the third coefficient and the fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time in the following manner: Based on a fitted straight line, a first correlation and a second correlation are determined. Wherein, the first correlation is the correlation between the first transmission time, the first reception time, the second transmission time, the second reception time, the third coefficient, and the fourth coefficient; and the second correlation is the correlation between the third transmission time, the third reception time, the fourth transmission time, the fourth reception time, the third coefficient, and the fourth coefficient. Based on the first correlation and the second correlation, the third coefficient and the fourth coefficient are determined.

[0122] In one embodiment, the determining unit 101 is further configured to: determine that a specified time meets preset filtering conditions before determining the specified coefficient. The specified coefficient includes a first coefficient and a second coefficient, and the specified time includes a first transmission time, a first reception time, a second transmission time, and a second reception time. Alternatively, the specified coefficient includes a third coefficient and a fourth coefficient, and the specified time includes a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time.

[0123] In one implementation, the preset screening conditions include: in, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. This is an adjustable coefficient. The value increases as the number of times the preset filtering conditions are not met at a specified time increases. t1 is the first sending time, t2 is the first receiving time, t3 is the second sending time, and t4 is the second receiving time. Alternatively, t1 is the third sending time, t2 is the third receiving time, t3 is the fourth sending time, and t4 is the fourth receiving time.

[0124] Figure 9 This is a block diagram illustrating an apparatus 200 for a clock synchronization method according to an exemplary embodiment. For example, apparatus 200 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0125] Reference Figure 9 The device 200 may include one or more of the following components: processing component 202, memory 204, power component 206, multimedia component 208, audio component 210, input / output (I / O) interface 212, sensor component 214, and communication component 216.

[0126] Processing component 202 typically controls the overall operation of device 200, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 202 may include one or more modules to facilitate interaction between processing component 202 and other components. For example, processing component 202 may include a multimedia module to facilitate interaction between multimedia component 208 and processing component 202.

[0127] Memory 204 is configured to store various types of data to support the operation of device 200. Examples of such data include instructions for any application or method operating on device 200, contact data, phonebook data, messages, pictures, videos, etc. Memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0128] The power supply component 206 provides power to the various components of the device 200. The power supply component 206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 200.

[0129] Multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 208 includes a front-facing camera and / or a rear-facing camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0130] Audio component 210 is configured to output and / or input audio signals. For example, audio component 210 includes a microphone (MIC) configured to receive external audio signals when device 200 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 204 or transmitted via communication component 216. In some embodiments, audio component 210 also includes a speaker for outputting audio signals.

[0131] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0132] Sensor assembly 214 includes one or more sensors for providing status assessments of various aspects of device 200. For example, sensor assembly 214 may detect the on / off state of device 200, the relative positioning of components such as the display and keypad of device 200, changes in the position of device 200 or a component of device 200, the presence or absence of user contact with device 200, the orientation or acceleration / deceleration of device 200, and temperature changes of device 200. Sensor assembly 214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 214 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0133] Communication component 216 is configured to facilitate wired or wireless communication between device 200 and other devices. Device 200 can access wireless networks based on communication standards, such as WiFi, 4G, or 5G, or combinations thereof. In one exemplary embodiment, communication component 216 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 216 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0134] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0135] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, which can be executed by a processor 220 of the device 200 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0136] It is understood that in this disclosure, "multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. The singular forms "a," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.

[0137] It is further understood that the terms "first," "second," etc., are used to describe various types of information, but this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another, and do not indicate a specific order or degree of importance. In fact, the expressions "first," "second," etc., are completely interchangeable. For example, without departing from the scope of this disclosure, first information can also be referred to as second information, and similarly, second information can also be referred to as first information.

[0138] It can be further understood that, unless otherwise specified, "connection" includes both direct connections where no other components exist between the two parties and indirect connections where other components exist between them.

[0139] It is further understood that although operations are described in a specific order in the accompanying drawings in the embodiments of this disclosure, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the shown operations to be performed to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.

[0140] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following scope of claims.

[0141] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A clock synchronization method, characterized in that, The clock synchronization method includes: The clock difference between the first device and the second device is determined based on the minimum transmission delay corresponding to the first device transmitting data to the second device multiple times, and the minimum transmission delay corresponding to the second device transmitting data to the first device multiple times. The first device and the second device transmit data based on a wireless local area network. Based on the clock difference, the clocks of the first device and the second device are synchronized. The determination of the clock difference between the first device and the second device includes: Obtain the correspondence between the clock value of the first device and the clock value of the second device, and determine the clock difference between the first device and the second device based on the correspondence; The correspondence between the clock values ​​of the first device and the second device is determined in advance using the following method: A first delay is determined, which is the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device. The first delay is determined based on the first transmission time recorded by the first device and the first reception time recorded by the second device. A second delay is determined, which is the minimum transmission delay corresponding to the second device making multiple second transmissions to the first device. The second delay is determined based on the second transmission time recorded by the second device and the second reception time recorded by the first device. Obtain a pre-configured first coefficient; determine a second coefficient based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time; obtain a fitted straight line characterizing the corresponding relationship based on the first coefficient and the second coefficient; wherein, in the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device; Before determining the specified coefficients, the method further includes: Determine if a specified time meets preset filtering conditions; wherein, the specified coefficients include a first coefficient and a second coefficient, and the specified time includes a first sending time, a first receiving time, a second sending time, and a second receiving time.

2. The clock synchronization method according to claim 1, characterized in that, The second coefficient is calculated using the following formula: Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

3. The clock synchronization method according to claim 1 or 2, characterized in that, The fitted straight line is expressed by the following formula: Among them, t m t is the clock value of the second device. s Let be the clock value of the first device, 'a' be the first coefficient, and 'offset' be the second coefficient.

4. The clock synchronization method according to claim 1, characterized in that, The method further includes: Determine the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time; Wherein, the third sending time and the fourth receiving time are recorded by the first device, the third receiving time and the fourth sending time are recorded by the second device, the difference between the third sending time and the third receiving time represents the minimum transmission delay corresponding to the first device making multiple third transmissions to the second device, and the difference between the fourth sending time and the fourth receiving time represents the minimum transmission delay corresponding to the first device making multiple fourth transmissions to the second device. Based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time, the third coefficient and the fourth coefficient are determined; The first coefficient is updated according to the third coefficient, and the second coefficient is updated according to the fourth coefficient.

5. The clock synchronization method according to claim 4, characterized in that, Based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time, the third coefficient and the fourth coefficient are determined, including: Based on the fitted straight line, the first correlation relationship and the second correlation relationship are determined; Wherein, the first association relationship is the association relationship between the first sending time, the first receiving time, the second sending time, the second receiving time, the third coefficient, and the fourth coefficient; the second association relationship is the association relationship between the third sending time, the third receiving time, the fourth sending time, the fourth receiving time, the third coefficient, and the fourth coefficient. Based on the first association relationship and the second association relationship, the third coefficient and the fourth coefficient are determined.

6. The clock synchronization method according to claim 4, characterized in that, The method further includes: Before determining the specified coefficient, ensure that the specified time meets the preset filtering conditions; The specified coefficients include a third coefficient and a fourth coefficient, and the specified times include a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time.

7. The clock synchronization method according to claim 1 or 6, characterized in that, The preset filtering conditions include: in, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. The adjustable coefficient, the The value increases as the number of times the preset filtering conditions are not met at the specified time increases; t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time; or t1 is the third transmission time, t2 is the third reception time, t3 is the fourth transmission time, and t4 is the fourth reception time.

8. A clock synchronization device, characterized in that, The clock synchronization device includes: A determining unit is configured to determine the clock difference between a first device and a second device. The clock difference is determined based on the minimum transmission delay corresponding to multiple data transmissions from the first device to the second device and the minimum transmission delay corresponding to multiple data transmissions from the second device to the first device. The first device and the second device transmit data based on a wireless local area network. A processing unit is configured to synchronize the clock of the first device with the clock of the second device based on the clock difference. The determining unit determines the clock difference between the first device and the second device in the following manner: Obtain the correspondence between the clock value of the first device and the clock value of the second device, and determine the clock difference between the first device and the second device based on the correspondence; The determining unit predetermines the correspondence between the clock values ​​of the first device and the clock values ​​of the second device in the following manner: A first delay is determined, which is the minimum transmission delay corresponding to multiple first transmissions from the first device to the second device. The first delay is determined based on the first transmission time recorded by the first device and the first reception time recorded by the second device. A second delay is determined, which is the minimum transmission delay corresponding to the second device making multiple second transmissions to the first device. The second delay is determined based on the second transmission time recorded by the second device and the second reception time recorded by the first device. Obtain a pre-configured first coefficient; determine a second coefficient based on the first delay, the second delay, the first transmission time, the first reception time, the second transmission time, and the second reception time; obtain a fitted straight line characterizing the corresponding relationship based on the first coefficient and the second coefficient; wherein, in the fitted straight line, the first coefficient is used to adjust the slope value of the clock value of the first device, and the second coefficient is used to adjust the intercept value of the clock value of the first device; Before determining the specified coefficient, the determining unit is further configured to: Determine if a specified time meets preset filtering conditions; wherein, the specified coefficients include a first coefficient and a second coefficient, and the specified time includes a first sending time, a first receiving time, a second sending time, and a second receiving time.

9. The clock synchronization device according to claim 8, characterized in that, The determining unit calculates the second coefficient using the following formula: Where offset is the second coefficient, t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time. For the first delay, The second delay is n, and the number of transmissions is n.

10. The clock synchronization device according to claim 8 or 9, characterized in that, The fitted straight line is expressed by the following formula: Among them, t m t is the clock value of the second device. s Let be the clock value of the first device, 'a' be the first coefficient, and 'offset' be the second coefficient.

11. The clock synchronization device according to claim 8, characterized in that, The determining unit is further configured to: Determine the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time; Wherein, the third sending time and the fourth receiving time are recorded by the first device, the third receiving time and the fourth sending time are recorded by the second device, the difference between the third sending time and the third receiving time represents the minimum transmission delay corresponding to the first device making multiple third transmissions to the second device, and the difference between the fourth sending time and the fourth receiving time represents the minimum transmission delay corresponding to the first device making multiple fourth transmissions to the second device. Based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time, the third coefficient and the fourth coefficient are determined; The first coefficient is updated according to the third coefficient, and the second coefficient is updated according to the fourth coefficient.

12. The clock synchronization device according to claim 11, characterized in that, The determining unit determines the third coefficient and the fourth coefficient based on the correlation between the third transmission time, the third reception time, the fourth transmission time, and the fourth reception time in the following manner: Based on the fitted straight line, the first correlation relationship and the second correlation relationship are determined; Wherein, the first association relationship is the association relationship between the first sending time, the first receiving time, the second sending time, the second receiving time, the third coefficient, and the fourth coefficient; the second association relationship is the association relationship between the third sending time, the third receiving time, the fourth sending time, the fourth receiving time, the third coefficient, and the fourth coefficient. Based on the first association relationship and the second association relationship, the third coefficient and the fourth coefficient are determined.

13. The clock synchronization device according to claim 11, characterized in that, The determining unit is further configured to: Before determining the specified coefficient, ensure that the specified time meets the preset filtering conditions; The specified coefficients include a third coefficient and a fourth coefficient, and the specified times include a third transmission time, a third reception time, a fourth transmission time, and a fourth reception time.

14. The clock synchronization device according to claim 8 or 13, characterized in that, The preset filtering conditions include: in, This represents the average transmission delay for each of the multiple data transmissions from the first device to the second device. The adjustable coefficient, the The value increases as the number of times the preset filtering conditions are not met at the specified time increases; t1 is the first transmission time, t2 is the first reception time, t3 is the second transmission time, and t4 is the second reception time; or t1 is the third transmission time, t2 is the third reception time, t3 is the fourth transmission time, and t4 is the fourth reception time.

15. A clock synchronization device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to execute the clock synchronization method according to any one of claims 1 to 7.

16. A storage medium, characterized in that, The storage medium stores instructions that, when executed by a processor, enable the processor to perform the clock synchronization method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Clock synchronization method and device

    CN110557826A

  • Time calibration method and device, equipment to be calibrated and storage medium

    CN112737762A

  • Clock synchronization method and device, electronic equipment and storage medium

    CN113687686A