Clock synchronization method and apparatus
By receiving absolute time and calibrating the local clock when the electronic device is connected to the wireless access network device, the problem of time accuracy degradation caused by crystal oscillator aging is solved, and high-precision time synchronization is achieved after the wireless access network device is disconnected.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU TD TECH LTD
- Filing Date
- 2021-09-10
- Publication Date
- 2026-07-21
AI Technical Summary
In the prior art, the local clock of electronic devices suffers from decreased time accuracy due to crystal oscillator aging, especially after the wireless access network device is disconnected, it cannot maintain high precision.
By receiving absolute time when the electronic device is connected to the wireless access network device, the count value of the local clock is determined, and the local clock is calibrated based on the count value after disconnection. Combined with temperature compensation and count difference processing, the accuracy of the clock is improved.
It improves the accuracy of the local clock of electronic devices after the wireless access network device disconnects, ensuring that the accuracy of time synchronization meets the requirements of different industrial and non-industrial scenarios.
Smart Images

Figure CN115802471B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of clock synchronization technology, and in particular to a clock synchronization method and device. Background Technology
[0002] In various industrial and non-industrial scenarios, electronic devices typically require precise timekeeping. These devices can be terminal devices or communication modules. For example, in industrial settings, terminal devices controlling production equipment use accurate timekeeping to ensure precise control of production processes. In smart grid systems, time is used for the accurate transmission and distribution of power. Engineers can pinpoint the location of power outages based on the time of power system anomalies. Therefore, terminal devices in smart grid systems also require accurate timekeeping. The required time accuracy varies depending on the specific scenario. For example, in the differential protection scenario of a power system, the required time accuracy is 1 microsecond; the required time accuracy for a power system's PMU (phasor measurement unit) is 10 microseconds; the required time accuracy for a dual AGV (automated guided vehicle) collaborative scenario is 100 microseconds; the required time accuracy for static instruments used in aerospace is 1 to 2 microseconds; and the required time accuracy for clocks is 10 microseconds, although 1 millisecond may also meet the requirements. In a data acquisition scenario with a sampling rate of 1000 Hz, the required time accuracy is 100 microseconds.
[0003] Therefore, improving the accuracy of the time used by electronic devices is an urgent problem to be solved. Summary of the Invention
[0004] This application provides a clock synchronization method and apparatus to improve the accuracy of time usage in electronic devices.
[0005] In a first aspect, this application provides a clock synchronization method applied to electronic devices, comprising:
[0006] When the electronic device is connected to a wireless access network device, it receives the first absolute time transmitted by the wireless access network device.
[0007] Determine the first count value of the counter corresponding to the local clock within the unit time corresponding to the first absolute time;
[0008] When the electronic device is disconnected from the wireless access network device, the second absolute time corresponding to the local clock is determined based on the first count value.
[0009] Optionally, determining the second absolute time corresponding to the local clock based on the first count value includes:
[0010] The difference between the first count value and the standard count value of the counter in multiple unit time periods is determined to obtain the count difference corresponding to each unit time period;
[0011] A reference count difference is determined based on the count difference corresponding to each unit of time.
[0012] The third count value is determined based on the sum of the reference count difference and the standard count value;
[0013] The second absolute time corresponding to the local clock is determined based on the third count value.
[0014] Optionally, determining the second absolute time corresponding to the local clock based on the third count value includes:
[0015] The second count value is obtained by counting using the counter.
[0016] When the second count value reaches the third count value, the current second absolute time is increased by the unit time to obtain the updated second absolute time.
[0017] Optionally, determining the reference count difference based on the count difference corresponding to each unit time includes:
[0018] The last determined count difference is set as the reference count difference; or,
[0019] The statistical value of the count difference corresponding to multiple units of time is determined as the reference count difference, and the statistical value includes one of the following: average value, maximum value, and minimum value.
[0020] Optionally, determining the third count value based on the sum of the reference count difference and the standard count value includes:
[0021] Determine the counting compensation value for the current temperature, which is used to compensate for the counting error per unit time corresponding to the current temperature;
[0022] The third count value is determined based on the sum of the reference count difference and the standard count value, and the count compensation value of the current temperature.
[0023] Optionally, the method further includes:
[0024] The second absolute time is converted into a time code output, and the time code includes at least one of the following: parallel time code and serial time code.
[0025] Optionally, the counter is a nanosecond counter, the unit time is 1 second, and the local clock of the electronic device is a crystal oscillator clock.
[0026] Secondly, this application provides a clock synchronization device for use in electronic devices, comprising:
[0027] The first absolute time receiving module is used to receive the first absolute time sent by the wireless access network device when the electronic device is connected to a wireless access network device.
[0028] The first counting module is used to determine the first count value of the counter corresponding to the local clock within a unit time corresponding to the first absolute time.
[0029] The second absolute time determination module is used to determine the second absolute time corresponding to the local clock based on the first count value when the electronic device is disconnected from the wireless access network device.
[0030] Optionally, the second absolute time determination module is further configured to:
[0031] When determining the second absolute time corresponding to the local clock based on the first count value, the difference between the first count value and the standard count value of the counter in multiple unit time periods is determined to obtain the count difference corresponding to each unit time period;
[0032] A reference count difference is determined based on the count difference corresponding to each unit of time.
[0033] The third count value is determined based on the sum of the reference count difference and the standard count value;
[0034] The second absolute time corresponding to the local clock is determined based on the third count value.
[0035] Optionally, the second absolute time determination module is further configured to:
[0036] When determining the second absolute time corresponding to the local clock based on the third count value, the second count value is obtained by counting using the counter.
[0037] When the second count value reaches the third count value, the current second absolute time is increased by the unit time to obtain the updated second absolute time.
[0038] Optionally, the second absolute time determination module is further configured to:
[0039] When determining a reference count difference based on the count difference corresponding to each unit time, the last determined count difference is used as the reference count difference; or,
[0040] The statistical value of the count difference corresponding to multiple units of time is determined as the reference count difference, and the statistical value includes one of the following: average value, maximum value, and minimum value.
[0041] Optionally, the second absolute time determination module is further configured to:
[0042] When determining the third count value based on the sum of the reference count difference and the standard count value, a count compensation value for the current temperature is determined. The count compensation value is used to compensate for the count error per unit time corresponding to the current temperature.
[0043] The third count value is determined based on the sum of the reference count difference and the standard count value, and the count compensation value of the current temperature.
[0044] Optionally, the device further includes:
[0045] A time code output module is used to convert the second absolute time into a time code output, wherein the time code includes at least one of the following: parallel time code and serial time code.
[0046] Optionally, the counter is a nanosecond counter, the unit time is 1 second, and the local clock of the electronic device is a crystal oscillator clock.
[0047] Thirdly, this application provides an electronic device, including: a memory and a processor;
[0048] Memory; memory used to store instructions executed by a computer;
[0049] When the processor executes the computer execution instructions, it causes the electronic device to implement the method described in the first aspect.
[0050] Fourthly, this application provides a computer program for implementing the method described in the first aspect.
[0051] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor of an electronic device, cause the electronic device to perform the method described in the first aspect.
[0052] This application provides a clock synchronization method and apparatus. The method includes: when an electronic device is connected to a wireless access network (WLAN) device, receiving a first absolute time transmitted by the WLAN device; determining a first count value of a counter corresponding to a local clock within a unit time corresponding to the first absolute time; and when the electronic device is disconnected from the WLAN device, determining a second absolute time corresponding to the local clock based on the first count value. This application can determine the first count value of the local clock within a unit time corresponding to the first absolute time transmitted by the WLAN device when the electronic device is connected to the WLAN device, so that the local clock can be calibrated based on the first count value when the electronic device is disconnected from the WLAN device. Since the first count value is an accurate count value determined when the electronic device is connected to the WLAN device, the accuracy of the local clock can be improved, thereby improving the accuracy of the time used for communication by the electronic device. Attached Figure Description
[0053] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0054] Figure 1 An exemplary schematic diagram of the architecture of a mobile communication system applied in an embodiment of this application is shown;
[0055] Figure 2 An exemplary diagram illustrates a clock synchronization process between an electronic device and a wireless access network device provided by the prior art;
[0056] Figure 3 An exemplary flowchart illustrates the steps of a clock synchronization method provided in an embodiment of this application;
[0057] Figure 4 An exemplary structural block diagram of a clock synchronization device provided in an embodiment of this application is shown;
[0058] Figure 5 An exemplary structural block diagram of an electronic device provided in an embodiment of this application is shown;
[0059] Figure 6 An exemplary block diagram of another electronic device provided in an embodiment of this application is shown.
[0060] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0061] 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 application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0062] Figure 1 An exemplary schematic diagram of the architecture of a mobile communication system applied in an embodiment of this application is shown. Figure 1 As shown, the mobile communication system includes core network equipment 110, radio access network equipment 120, and at least one terminal device (such as...). Figure 1 The terminal devices 130 and 140 are included in this document. The terminal devices connect wirelessly to the wireless access network equipment, which in turn connects wirelessly or via a wired connection to the core network equipment. The core network equipment and the wireless access network equipment can be independent physical devices, or the functions of the core network equipment and the logical functions of the wireless access network equipment can be integrated onto the same physical device. Alternatively, a single physical device can integrate some of the functions of the core network equipment and some of the functions of the wireless access network equipment. The terminal devices can be fixed in location or mobile. Figure 1 This is just an illustration; the communication system may also include other wireless access network devices, such as wireless repeaters and wireless backhaul devices. Figure 1 Not shown in the diagram. The embodiments of this application do not limit the number of core network devices, radio access network devices, and terminal devices included in the mobile communication system.
[0063] A wireless access network device is an access device that enables terminal devices to access a mobile communication system wirelessly. It can be a base station, an evolved NodeB (eNodeB), a transmission reception point (TRP), a next-generation NodeB (gNB) in a 5G mobile communication system, a base station in a future mobile communication system, or an access node in a WiFi system. It can also be a module or unit that performs some of the functions of a base station; for example, it can be a central unit (CU) or a distributed unit (DU). The embodiments in this application do not limit the specific technology or device form used in the wireless access network device.
[0064] In the embodiments of this application, the apparatus for implementing the functions of a wireless access network device can be a wireless access network device itself; it can also be an apparatus capable of supporting the wireless access network device in implementing the functions, such as a chip system. This apparatus can be installed in or used in conjunction with the wireless access network device. In the technical solutions provided in the embodiments of this application, the example of a wireless access network device as the apparatus for implementing the functions of the wireless access network device is used to describe the technical solutions provided in the embodiments of this application.
[0065] The terminal devices involved in the embodiments of this application can also be referred to as Terminal, User Equipment (UE), Mobile Station (MS), Mobile Terminal (MT), etc. Terminal devices can be mobile phones, tablets, computers with wireless transceiver capabilities, virtual reality terminal devices, augmented reality terminal devices, wireless terminals in industrial control, wireless terminals in autonomous driving, wireless terminals in remote surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on. The embodiments of this application do not limit the specific technologies or device forms used in the terminal devices.
[0066] During communication between the terminal device and the wireless access network device, the time used by the terminal device and the wireless access network device needs to be completely synchronized. That is to say, the terminal device and the wireless access network device recognize the same moment.
[0067] In existing technologies, the clocks used for communication between wireless access network equipment and terminal equipment are typically high-precision clocks provided by core network equipment through technologies such as GNSS (Global Navigation Satellite System) and 1588V2. Specifically, refer to... Figure 2 As shown, firstly, the wireless access network device obtains a high-precision clock from the core network device; then, the wireless access network device associates the high-precision clock with the air interface radio frame boundary to obtain a first absolute time, and sends it to the terminal device accessing the wireless access network device through air interface signaling; finally, after receiving the first absolute time sent by the wireless access network device, the terminal device determines a second absolute time based on the first absolute time and the air interface transmission delay, and outputs the second absolute time for communication.
[0068] As can be seen, the clock of the aforementioned terminal device is transmitted by the wireless access network (WLAN) device, thus requiring the terminal device to connect to one of the WLAN devices. In existing technology, when the terminal device disconnects from the WLAN device—that is, when the terminal device cannot connect to any WLAN device—it cannot obtain accurate clock information from the WLAN device. In this case, the terminal device typically uses its local clock for communication.
[0069] The local clock of a terminal device is typically generated by multiplying the frequency of a crystal oscillator. A counter counts the oscillations of the crystal oscillator, and the local clock is determined based on the count value. For example, if the current local clock is T1, then after the crystal oscillator oscillates N times, the local clock is updated to T2. T1 and T2 differ by one second, and the local clock is continuously updated in this way. In other words, the local clock is incremented by one second after every N oscillations of the crystal oscillator.
[0070] However, with prolonged use, the oscillation frequency of the crystal oscillator will change. That is, under standard conditions, a crystal oscillator should oscillate N times per second, but with prolonged use, its components age, causing the crystal oscillator to oscillate N+m times per second. This results in poor accuracy of the local clock, reducing the accuracy of the time used for communication by terminal devices.
[0071] To address the aforementioned issues, embodiments of this application can determine a first count value of the local clock within a unit time period corresponding to a first absolute time transmitted by the wireless access network device when the electronic device is connected to a wireless access network device. This first count value is then used to calibrate the local clock when the electronic device is disconnected from the wireless access network device. This improves the accuracy of the local clock, thereby enhancing the accuracy of the time used by the electronic device.
[0072] The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0073] Figure 3 An exemplary flowchart illustrates the steps of a clock synchronization method provided in an embodiment of this application, applied to an electronic device, which is the aforementioned terminal device or communication module. (Refer to...) Figure 3 As shown, the clock synchronization method includes S101 to S103.
[0074] S101: When an electronic device is connected to a wireless access network device, receiving the first absolute time transmitted by the wireless access network device.
[0075] The first absolute time is obtained by the wireless access device after associating the high-precision clock sent by the core network device with the air interface wireless frame boundary, and is therefore a precise time.
[0076] S102: Determine the first count value of the counter corresponding to the local clock within the unit time corresponding to the first absolute time.
[0077] The local clock is the clock source provided by the electronic device. It keeps time by the vibration of a crystal oscillator installed within the device; therefore, it can also be called a crystal oscillator clock. The number of vibrations per second of the crystal oscillator corresponds to a nanosecond counter. Typically, the number of vibrations of the local clock is much smaller than the count value of the nanosecond counter.
[0078] The counters described above can be of various types and precisions. Considering precision requirements, nanosecond counters are typically used. When the unit time is 1 second, the nanosecond counter's count value within that unit time is 10. 9 In other words, the standard count value of a nanosecond counter is 10. 9 .
[0079] It should be noted that, in addition to performing S102, the electronic device in this application embodiment may also need to determine a second absolute time based on the first absolute time sent by the wireless access network device, so as to communicate based on the second absolute time.
[0080] S103: When the electronic device is disconnected from the wireless access network device, determine the second absolute time corresponding to the local clock based on the first count value.
[0081] Specifically, when the electronic device is disconnected from the wireless access network device, the electronic device can use a counter to count to obtain a second count value, and when the second count value reaches the first count value, the current second absolute time is increased by a unit of time, for example, by one second; when the second count value has not reached the first count value, the counting continues.
[0082] When only the count value corresponding to a single unit of time is counted, the count value corresponding to that unit of time can be used as the second count value.
[0083] When the above statistics are collected for multiple unit time values, the count value corresponding to the last unit time can be determined as the second count value, or the second absolute time can be determined according to the difference between the count value and the standard count value.
[0084] Specifically, determining the second absolute time based on the difference between the count value and the standard count value can include: first, determining the difference between the first count value and the standard count value of the counter in multiple unit time periods to obtain the count difference corresponding to each unit time period; then, determining a reference count difference based on the count difference corresponding to each unit time period; then, determining a third count value based on the sum of the reference count difference and the standard count value; and finally, determining the second absolute time corresponding to the local clock based on the third count value.
[0085] The following example illustrates the process of determining the count difference.
[0086] After obtaining the first count value N1 in the first unit time T1, the difference between N1 and the standard count value SN is calculated to obtain the count difference MN1 corresponding to T1; after obtaining the second count value N2 in the second unit time T2, the difference between N2 and the standard count value SN is calculated to obtain the count difference MN2 corresponding to T2; after obtaining the second count value N3 in the third unit time T3, the difference between N3 and the standard count value SN is calculated to obtain the count difference MN3 corresponding to T3.
[0087] Wherein, T1, T2 and T3 can be three consecutive units of time or discontinuous units of time, and the embodiments of this application do not impose any restrictions on them.
[0088] After obtaining MN1, MN2, and MN3, the reference count difference can be determined based on MN1, MN2, and MN3. There are several methods for determining the reference count difference.
[0089] The first method involves randomly selecting a reference count difference from multiple count differences, that is, determining any one of MN1, MN2, and MN3 as the reference count difference.
[0090] The second method is to determine the last determined count difference as the reference count difference, that is, to determine the count difference MN3 corresponding to the last unit time T3 as the reference count difference.
[0091] Thirdly, the statistical value of the count difference corresponding to multiple unit time periods is determined as the reference count difference. The statistical value includes one of the following: average, maximum, or minimum. That is, the average, maximum, or minimum value of MN1, MN2, and MN3 is determined as the reference count difference.
[0092] After obtaining the reference count difference, the sum of the reference count difference and the standard count value can be used as the third count value. Alternatively, the temperature-induced error can be considered, and temperature compensation can be applied to the local clock to obtain the third count value.
[0093] The temperature compensation process may include: first, determining the count compensation value for the current temperature, which is used to compensate for the counting error per unit time corresponding to the current temperature; and then determining a third count value based on the sum of the reference count difference and the standard count value, and the count compensation value for the current temperature.
[0094] Specifically, when the count compensation value is used to represent the increase in the count value due to the current temperature, the sum of the reference count difference and the standard count value, and the sum of the count compensation value at the current temperature are determined as the third count value. When the count compensation value is used to represent the decrease in the count value due to the current temperature, the difference between the sum of the reference count difference and the standard count value, and the sum of the count compensation value at the current temperature are determined as the third count value.
[0095] After obtaining the third count value, the second absolute time corresponding to the local clock can be determined from the third count value. Specifically, firstly, the second count value can be obtained by counting with a counter; then, when the second count value reaches the third count value, the current second absolute time is increased by a unit of time to obtain the updated second absolute time.
[0096] After obtaining the second absolute time, the electronic device can also convert the second absolute time into a time code output, which includes at least one of the following: parallel time code and serial time code.
[0097] Understandably, the output timecode is used for communication between electronic devices and wireless access network devices, or to provide users with accurate time.
[0098] Correspondingly, Figure 3 In addition to the clock synchronization method shown, this application also provides a clock synchronization device for use in electronic devices, wherein the electronic devices are the aforementioned terminal devices or communication modules. Figure 4 An exemplary structural block diagram of a clock synchronization device provided in an embodiment of this application is shown. (Refer to...) Figure 4 As shown, the clock synchronization device 200 includes:
[0099] The first absolute time receiving module 201 is used to receive the first absolute time sent by the wireless access network device when the electronic device is connected to a wireless access network device.
[0100] The first counting module 202 is used to determine the first count value of the counter corresponding to the local clock within a unit time corresponding to the first absolute time.
[0101] The second absolute time determination module 203 is used to determine the second absolute time corresponding to the local clock based on the first count value when the electronic device is disconnected from the wireless access network device.
[0102] Optionally, the second absolute time determination module 203 is further configured to:
[0103] When determining the second absolute time corresponding to the local clock based on the first count value, the difference between the first count value and the standard count value of the counter in multiple unit time periods is determined to obtain the count difference corresponding to each unit time period; a reference count difference is determined based on the count difference corresponding to each unit time period; a third count value is determined based on the sum of the reference count difference and the standard count value; and the second absolute time corresponding to the local clock is determined based on the third count value.
[0104] Optionally, the second absolute time determination module 203 is further configured to:
[0105] When determining the second absolute time corresponding to the local clock based on the third count value, the second count value is obtained by counting using the counter; when the second count value reaches the third count value, the current second absolute time is increased by the unit time to obtain the updated second absolute time.
[0106] Optionally, the second absolute time determination module 203 is further configured to:
[0107] When determining a reference count difference based on the count difference corresponding to each unit time, the last determined count difference is determined as the reference count difference; or, the statistical value of the count differences corresponding to multiple unit times is determined as the reference count difference, and the statistical value includes one of the following: average value, maximum value, and minimum value.
[0108] Optionally, the second absolute time determination module 203 is further configured to:
[0109] When determining the third count value based on the sum of the reference count difference and the standard count value, a count compensation value for the current temperature is determined. The count compensation value is used to compensate for the count error within a unit time corresponding to the current temperature. The third count value is determined based on the sum of the reference count difference and the standard count value, and the count compensation value for the current temperature.
[0110] Optionally, the device further includes:
[0111] A time code output module is used to convert the second absolute time into a time code output, wherein the time code includes at least one of the following: parallel time code and serial time code.
[0112] Optionally, the counter is a nanosecond counter, the unit time is 1 second, and the local clock of the electronic device is a crystal oscillator clock.
[0113] The above-described clock synchronization device is a device embodiment corresponding to the above-described method embodiment, and has the same technical effects as the method embodiment. For detailed description, please refer to the detailed description of the method embodiment. The embodiments of this application will not be repeated here.
[0114] The aforementioned electronic devices can be referred to as electronic devices. Figure 5 An exemplary structural block diagram of an electronic device provided in an embodiment of this application is shown. The electronic device 300 includes a processor 301 and a memory 302 for storing computer-executed instructions of the processor 301. When the processor 301 executes the computer-executed instructions, the electronic device 300 implements the aforementioned clock synchronization method.
[0115] In addition, the electronic device also includes a receiver 303 and a transmitter 304. The receiver 303 is used to receive information from other devices or equipment and forward it to the processor 301, and the transmitter 304 is used to send information to other devices or equipment.
[0116] Furthermore, Figure 6 An exemplary structural block diagram of another electronic device provided in an embodiment of this application is illustrated. The electronic device 900 can be a terminal device. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0117] like Figure 6 As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0118] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0119] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, it performs the functions defined in the methods of the embodiments of this application.
[0120] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0121] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0122] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
[0123] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0124] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0125] The units described in the embodiments of this application can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0126] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0127] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0128] This application also provides a computer program for implementing the aforementioned clock synchronization method.
[0129] This application also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions in the storage medium are executed by the processor of an electronic device, the electronic device implements the aforementioned clock synchronization method.
[0130] Other embodiments of this application 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 application that follow the general principles of this application 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 application are indicated by the following claims.
[0131] It should be understood that this application is not limited to the precise structure 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 application is limited only by the appended claims.
Claims
1. A clock synchronization method, characterized in that, Applied to electronic devices, including: When the electronic device is connected to a wireless access network device, it receives the first absolute time transmitted by the wireless access network device. Determine the first count value of the counter corresponding to the local clock within the unit time corresponding to the first absolute time. The first absolute time is obtained by the wireless access device after associating the high-precision clock sent by the core network device with the air interface wireless frame boundary. When the electronic device is disconnected from the wireless access network device, a second count value is obtained by counting with the counter, a third count value is determined based on the sum of the reference count difference and the standard count value, and when the second count value reaches the third count value, the current second absolute time is increased by the unit time to obtain the updated second absolute time; The second absolute time is converted into a time code output, and the time code includes at least one of the following: parallel time code and serial time code.
2. The method according to claim 1, characterized in that, The step of determining the third count value based on the sum of the reference count difference and the standard count value includes: The difference between the first count value and the standard count value of the counter in multiple unit time periods is determined to obtain the count difference corresponding to each unit time period; A reference count difference is determined based on the count difference corresponding to each unit of time. The third count value is determined based on the sum of the reference count difference and the standard count value.
3. The method according to claim 2, characterized in that, The step of determining the reference count difference based on the count difference corresponding to each unit time includes: The last determined count difference is set as the reference count difference; or, The statistical value of the count difference corresponding to multiple units of time is determined as the reference count difference, and the statistical value includes one of the following: average value, maximum value, and minimum value.
4. The method according to claim 2, characterized in that, Determining the third count value based on the sum of the reference count difference and the standard count value includes: Determine the counting compensation value for the current temperature, which is used to compensate for the counting error per unit time corresponding to the current temperature; The third count value is determined based on the sum of the reference count difference and the standard count value, and the count compensation value of the current temperature.
5. The method according to any one of claims 1 to 4, characterized in that, The counter is a nanosecond counter, the unit time is 1 second, and the local clock of the electronic device is a crystal oscillator clock.
6. A clock synchronization device, characterized in that, Applied to electronic devices, including: The first absolute time receiving module is used to receive the first absolute time sent by the wireless access network device when the electronic device is connected to a wireless access network device. The first counting module is used to determine the first count value of the counter corresponding to the local clock within a unit time corresponding to the first absolute time. The first absolute time is obtained by the wireless access device after associating the high-precision clock sent by the core network device with the air interface wireless frame boundary. The second absolute time determination module is used to obtain a second count value by counting through the counter when the electronic device is disconnected from the wireless access network device, determine a third count value based on the sum of the reference count difference and the standard count value, and when the second count value reaches the third count value, increase the current second absolute time by the unit time to obtain an updated second absolute time. A time code output module is used to convert the second absolute time into a time code output, wherein the time code includes at least one of the following: parallel time code and serial time code.
7. An electronic device, characterized in that, include: Memory, processor; Memory; Memory used to store instructions executed by the computer; When the processor executes the computer execution instructions, it causes the electronic device to implement the method of any one of claims 1 to 5.
8. A computer program product, characterized in that, The computer program is used to implement the method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when executed by a processor of an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 5.