CN112462846A - Clock correction method, clock correction device, computer equipment and storage medium - Google Patents

Clock correction method, clock correction device, computer equipment and storage medium Download PDF

Info

Publication number
CN112462846A
CN112462846A CN202011466731.7A CN202011466731A CN112462846A CN 112462846 A CN112462846 A CN 112462846A CN 202011466731 A CN202011466731 A CN 202011466731A CN 112462846 A CN112462846 A CN 112462846A
Authority
CN
China
Prior art keywords
time
state
system time
rate ratio
timing rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011466731.7A
Other languages
Chinese (zh)
Inventor
张文广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Etekcity Corp
Original Assignee
Etekcity Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Etekcity Corp filed Critical Etekcity Corp
Priority to CN202011466731.7A priority Critical patent/CN112462846A/en
Publication of CN112462846A publication Critical patent/CN112462846A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/12Synchronisation of different clock signals provided by a plurality of clock generators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays

Abstract

The invention discloses a clock correction method, which comprises the following steps: acquiring corresponding first system time when the equipment enters a dormant state from an operating state; acquiring corresponding second system time when the equipment enters an operating state from a dormant state; acquiring a calibration coefficient, wherein the calibration coefficient is used for indicating the timing rate ratio of the equipment in the running state and the dormant state; and calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time. The method calibrates the system time in time when the equipment is awakened, and solves the problem of inaccurate clock caused by dormancy. In addition, a clock correction device, a computer device and a storage medium are also provided.

Description

Clock correction method, clock correction device, computer equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a clock correction method, a clock correction device, computer equipment and a storage medium.
Background
When a user uses an intelligent product, certain requirements are imposed on time accuracy in an interaction process, such as actions of recording events at a certain time point. In actual use, due to the requirements of power saving and energy saving, the device can enter a deep sleep state within a certain idle time. When the device is awakened from the deep sleep mode, the current real-time clock of the device is inaccurate after the awakening due to the error of the sleep clock in the chip, and the use experience of a user is influenced.
Disclosure of Invention
In view of the above, it is necessary to provide a clock correction method, a clock correction apparatus, a computer device, and a storage medium, which can accurately calibrate a clock.
To achieve the above object, a first aspect of the present invention provides a clock correction method, including:
acquiring system time corresponding to the device entering a dormant state from an operating state as first system time;
acquiring corresponding second system time when the equipment enters an operating state from a dormant state;
acquiring a calibration coefficient, wherein the calibration coefficient is used for indicating a timing rate ratio of the equipment in a running state and a dormant state;
and calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time.
To achieve the above object, a second aspect of the present invention provides a clock correction apparatus comprising:
the first acquisition module is used for acquiring corresponding first system time when the equipment enters a dormant state from an operating state;
the second acquisition module is used for acquiring a second system time corresponding to the running time of the equipment from the dormant state;
a third obtaining module, configured to obtain a calibration coefficient, where the calibration coefficient is used to indicate a timing rate ratio of the device in an operating state and a dormant state;
and the calibration module is used for calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time.
To achieve the above object, a third aspect of the present invention provides a computer device comprising a memory and a processor, the memory storing a computer program, which, when executed by the processor, causes the processor to perform the steps of the method according to the first aspect.
To achieve the above object, a fourth aspect of the present invention is a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the method according to the first aspect.
The clock correction method comprises the following steps of acquiring corresponding first system time when the equipment enters a sleep state from a running state; acquiring corresponding second system time when the equipment enters an operating state from a dormant state; acquiring a calibration coefficient, wherein the calibration coefficient is used for indicating a timing rate ratio of the equipment in a running state and a dormant state; and calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time. According to the clock calibration method, the ratio of the pre-calculated or stored timing rate of the equipment in the running state to the timing rate of the equipment in the dormant state is used as a calibration coefficient, when the equipment is awakened, the second system time when the equipment is awakened is calibrated to obtain the calibrated time, the system time is calibrated in time when the equipment is awakened, and the problem of inaccurate clock caused by dormancy is solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Wherein:
FIG. 1 is a flow diagram of a clock correction method in one embodiment;
FIG. 2 is a flow chart of a clock correction method in another embodiment;
FIG. 3 is a flow chart of a clock correction method in yet another embodiment;
FIG. 4 is a block diagram showing the structure of a clock correction apparatus according to an embodiment;
FIG. 5 is a block diagram showing the structure of a clock correction apparatus in another embodiment;
FIG. 6 is a block diagram showing the structure of a clock correction apparatus in still another embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, a clock correction method is proposed, which can be applied to a terminal, and this embodiment is exemplified by being applied to a terminal. The clock correction method specifically comprises the following steps:
step 102, acquiring a first system time corresponding to the device entering a sleep state from an operating state.
The system Time refers to the Time displayed by the system, and is also called RTC (Real Time Clock). When the equipment runs, namely is in a running state, the equipment can acquire the UTC time of the NTP server through network communication, and the acquired UTC time is taken as the current time of the system. Ntp (network Time protocol) server is a server used for Time synchronization. UTC (Coordinated Universal Time) Time can be understood as standard Time. The first system time is the system time when the device enters the sleep state from the running state, and the system time is the accurate time.
The trigger condition for the device to enter the sleep state from the running state may be, for example: when the equipment is in a starting state, a user does not perform any operation on the equipment within a certain time, and the equipment enters a dormant state; or a specific operation instruction for entering the dormant state from the running state is set for the equipment, and when the operation instruction is executed, the equipment enters the dormant state, such as closing the display, pressing a specific key and the like.
The trigger condition for the device to enter the running state from the sleep state may be, for example: when the equipment is in a dormant state, a user operates a physical key or a virtual key of the equipment, and the equipment enters an operating state; or a specific instruction for entering the running state from the sleep state is set for the device, for example, a sleep time is set for the device, and after the sleep time, the device enters the running state from the sleep state.
And 104, acquiring a second system time corresponding to the device entering the running state from the dormant state.
The device system time is acquired when the device is awakened from the sleep state, namely when the device is detected to enter the running state from the sleep state, and is called as a second system time for distinguishing. Since the timing rate (also referred to as "timing frequency") in the sleep state is different from the timing rate in the running state, when the device enters the running state from the sleep state, an error exists in the acquired second system time.
And 106, acquiring a calibration coefficient, wherein the calibration coefficient is used for indicating the ratio of the timing rate of the equipment in the running state to the timing rate of the equipment in the sleep state.
Wherein the calibration factor is used to calibrate the second system time. Since the calibration needs to be performed immediately after the second system time is acquired, the calibration coefficient needs to be calculated in advance or stored in advance in order to increase the calibration speed. The timing rate ratio may be considered fixed over a period of time, and the calibration factor is used to indicate the timing rate ratio of the device in the active state versus the sleep state. In one embodiment, a ratio of the timing rates of the device in the operating state and the device in the sleep state, which is calculated when the device enters the operating state from the sleep state last time, may be used as the current calibration coefficient; in another embodiment, a fixed calibration factor may be pre-calculated and stored in the system.
And 108, calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time.
The clock correction method comprises the steps of firstly, acquiring corresponding first system time when the equipment enters a sleep state from a running state; then, acquiring corresponding second system time when the equipment enters the running state from the dormant state; further, a calibration coefficient is obtained, wherein the calibration coefficient is used for indicating the timing rate ratio of the equipment in the running state and the dormant state; and finally, calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time. According to the clock calibration method, the ratio of the timing rate of the equipment in the running state and the timing rate of the equipment in the dormant state, which is obtained through the last calculation, is used as a calibration coefficient, when the equipment enters the dormant state from the running state, the second system time of the equipment is calibrated to obtain the calibrated time, the system time is calibrated in time when the equipment enters the running state from the dormant state, and the problem of clock inaccuracy caused by dormancy is solved.
The clock correction method of the present invention is further explained below.
In one embodiment, for step 108, the calibrating the second system time according to the first system time, the second system time, and the calibration coefficient to obtain a calibrated time includes: calculating a first time difference between the second system time and the first system time; calculating to obtain a time adjustment value according to the first time difference and the calibration coefficient; and determining the calibrated time according to the time adjustment value and the first system time.
And calculating a first time difference between the second system time and the first system time, wherein the calculated first time difference is a counted duration according to the timing rate in the sleep state. Because the timing rate in the sleep state is different from the timing rate in the running state, the time length converted into the running state needs to be calculated according to the time difference and the calibration coefficient, the time length in the running state, namely the time adjustment value, is calculated according to the product of the time difference and the calibration coefficient, and then the calibrated time is determined according to the time adjustment value and the first system time.
Specifically, the calibrated time is calculated by the following formula, where T ═ T (T)2-T1)*K+T1Where T represents the time after calibration, K represents the calibration coefficient, T1Is a first system time, T2Is the second system time. The clock correction method can be used for equipment with a sleep function, a user can obtain high-precision system time under the condition that a real-time clock chip circuit is not additionally arranged, and the method has a dynamic calibration function and is suitable for use scenes of daily intelligent equipment.
Note that, the calibration coefficient K is obtained in step 106. In one embodiment, the obtaining the calibration coefficient further includes: when the equipment enters the running state from the sleep state for the first time, a preset value is obtained as the calibration coefficient, when the equipment enters the running state from the sleep state for the Nth time, the calibration coefficient is a corresponding timing rate ratio when the equipment enters the running state from the sleep state for N-1 times, and N is a positive integer greater than 1.
When the device enters the running state from the sleep state for the first time, a preset value is needed to be set, and then the preset value is used as the calibration coefficient to perform calibration calculation.
After the calibrated time is obtained through calculation, the timing rate ratio between the current corresponding running state and the sleep state needs to be calculated to serve as the next calibration coefficient.
For example, when the device enters the running state from the sleep state for the 5 th time, the calibration factor should be the corresponding timing rate ratio when the device enters the running state from the sleep state for the 4 th time.
And the timing rate ratio of the M time from the sleep state to the running state is calculated in the following way. For the case that M is a positive integer when the device enters the running state from the sleep state M times, as shown in fig. 2, the calculation method of the corresponding timing rate ratio when the device enters the running state from the sleep state M times includes the following steps:
step 202, acquiring a first system time corresponding to the mth time when the device enters the sleep state from the running state.
And 204, acquiring a second system time corresponding to the Mth time when the equipment enters the running state from the sleep state.
Step 206, calculating a first time difference between the second system time corresponding to the mth time and the first system time corresponding to the mth time.
Wherein, the time difference between the second system time and the first system time is calculated, and is called as the first time difference. The first time difference may be understood as a time difference statistically obtained at the timing rate of the sleep state.
And step 208, acquiring the universal coordinated time UTC corresponding to the Mth time when the equipment enters the running state from the sleep state and the network consumed time corresponding to the UTC time acquisition process.
The UTC time is standard time, and when the device enters the running state from the sleep state, it is time-consuming to acquire the UTC time from the NTP server, and to acquire the time from the NTP server through a network (for example, wifi or bluetooth, etc.), so for accuracy of subsequent calculation, it is necessary to determine the time consumed by the network, that is, the time consumed in the process of acquiring the UTC time from the NTP server.
And step 210, calculating to obtain a second time difference according to the UTC time, the network time consumption and the first system time.
And calculating to obtain a second time difference according to the obtained UTC time, the network time consumption and the first system time, namely subtracting the network time consumption from the obtained UTC time, and then subtracting the first system time to obtain the second time difference. The second time difference can be understood as a time difference statistically obtained at the timing rate of the operating state.
Specifically, the second time difference is expressed by the following formula: t is0=TUTC-Toffset-T1,TUTCIndicating the UTC time, T, acquiredoffsetRepresents the network time consumption T corresponding to the UTC time acquisition process1Representing a first system time, T0Representing a second time difference.
And 212, calculating to obtain a timing rate ratio corresponding to the mth time of the equipment entering the running state from the sleep state according to the first time difference and the second time difference corresponding to the mth time.
For the same period of time, the first time difference is obtained through statistics according to the timing rate in the sleep state, the second time difference is obtained through statistics according to the timing rate in the running state, the ratio of the second time difference to the first time difference is calculated, the calculated timing rate ratio is obtained, and the timing rate ratio is used as a calibration coefficient for calibrating the second system time when the next device enters the running state from the sleep state. According to the calibration coefficient, the second system time entering the running state from the sleep state can be accurately corrected, so that the problem of time error caused by sleep is solved.
In another embodiment, the calculating, according to the first time difference and the second time difference corresponding to the mth time, a timing rate ratio corresponding to the mth time that the device enters the operating state from the sleep state includes: calculating to obtain a first timing rate ratio according to the ratio of the second time difference to the first time difference; acquiring a historical timing rate ratio obtained by historical calculation; and calculating the first timing rate ratio and the historical timing rate ratio by adopting a smoothing algorithm to obtain the timing rate ratio.
Among other things, to make the calculated timing rate ratio more accurate. Further modified using a weighted average algorithm. And taking the ratio of the second time difference to the first time difference as a first timing rate ratio, acquiring a historical timing rate ratio, and calculating by adopting a weighted smoothing algorithm according to the first timing rate ratio and the historical timing rate ratio to obtain the timing rate ratio.
It should be noted that the first step may be performedAnd calculating the timing rate ratio and the historical timing rate ratio by adopting an exponential weighting smoothing algorithm to obtain the timing rate ratio. The specific formula is as follows, L ═ a × LM+b*LM-1Where a + b is 1 and L is the required timing rate ratio for corresponding to the calibration coefficient. L isMRepresenting a first timing rate ratio, LM-1Representing a historical timing rate ratio.
The historical clocking rate ratio refers to a previously calculated clocking rate ratio, and in one embodiment, the historical clocking rate ratio includes: a timing rate ratio calculated by the M-1 device from the sleep state to the active state, in another embodiment, the historical timing rate ratio comprises: the timing rate ratio calculated when the M-1 time equipment enters the running state from the sleep state, the timing rate ratio calculated when the M-2 time equipment enters the running state from the sleep state and the like. The historical timing rate ratio can be set in a user-defined mode according to needs, and the timing rate ratio obtained by calculation when the M-1 time equipment enters the running state from the sleep state is generally selected as the historical timing rate ratio.
Before obtaining the historical timing rate ratio, firstly, judging whether the historical timing rate ratio exists for 1 time or more than 1 time (namely whether M is more than 1), if so, obtaining the historical timing rate ratio, and if not, directly taking the first timing rate ratio as the timing rate ratio.
For calculating the timing rate ratio, the following method may be used.
As shown in fig. 3, in an embodiment, before acquiring the calibration coefficient, the method further includes:
step 302, a first RTC count within a preset time is measured in an operating state of the device through the accessed external accurate clock.
The external precise clock is an external device, can be an external MCU (microprogrammed control Unit) for timing input, can also be a 555 timer and the like, is used for counting RTC (real time clock) counts under the timing of the external precise clock, and the RTC counts can be understood as counting the clock frequency in an operating state or a sleep state within preset time. Specifically, the RTC count in the running state (non-sleep state) for a preset time (e.g., 1 second) is measured by an external precision clock, and is referred to herein as a "first RTC count" for distinction from the sleep state hereinafter.
And step 304, measuring a second RTC count of the device in a sleep state within a preset time through the accessed external precise clock.
Wherein, likewise, the "second RTC count" in the sleep state is measured using an external precision clock "
Step 306, calculating a timing rate ratio according to the first RTC count and the second RTC count.
And calculating the ratio of the first RTC count to the second RTC count, wherein the ratio is a timing rate ratio. Specifically, the following formula can be adopted: L-CNT 1/CNT2, where L represents the clocking rate ratio, CNT1 represents the first RTC count, and CNT2 represents the second RTC count.
In another embodiment, the clock correction method further includes: measuring the first RTC count and the second RTC count in a plurality of preset times through the external precision clock, and calculating the ratio of the first RTC count to the second RTC count in each preset time to obtain a plurality of groups of data; and obtaining a timing rate ratio by adopting a smoothing algorithm on the multiple groups of data.
In order to obtain an accurate timing rate ratio, when a mode of accessing an external clock for measurement is adopted, repeated calculation is preferably adopted for multiple times, so that multiple groups of data are obtained, and the multiple groups of data are used for performing smooth calculation to obtain the timing rate ratio. The timing rate ratio is used as a calibration factor. The smoothing algorithm may be a weighted average algorithm or an exponential weighted smoothing algorithm.
The calibration coefficient is obtained based on external accurate clock measurement and is accurate, so that dynamic adjustment is not needed, and the timing rate ratio is used as the calibration coefficient for each calibration.
As shown in fig. 4, there is provided a clock correction apparatus including:
a first obtaining module 402, configured to obtain a first system time corresponding to when a device enters a sleep state from an operating state;
a second obtaining module 404, configured to obtain a second system time corresponding to when the device enters the running state from the dormant state;
a third obtaining module 406, configured to obtain a calibration coefficient, where the calibration coefficient is used to indicate a timing rate ratio of the device in the operating state and the dormant state;
the calibration module 408 is configured to calibrate the second system time according to the first system time, the second system time, and the calibration coefficient, so as to obtain a calibrated time.
In one embodiment, the calibration module 408 is further configured to calculate a first time difference between the second system time and the first system time; calculating to obtain a time adjustment value according to the first time difference and the calibration coefficient; and determining the calibrated time according to the time adjustment value and the first system time.
In an embodiment, the third obtaining module 406 is further configured to obtain a preset value as the calibration coefficient when the device enters the running state from the sleep state for the first time, where the calibration coefficient is a corresponding timing rate ratio when the device enters the running state from the sleep state N-1 times when the device enters the running state from the sleep state for the nth time, and N is a positive integer greater than 1.
As shown in fig. 5, in an embodiment, the clock correction apparatus further includes:
a first calculating module 410, configured to calculate a first time difference between a second system time corresponding to an mth time and the first system time corresponding to the mth time when the device enters the operating state from the sleep state for the mth time, where M is a positive integer;
a fourth obtaining module 412, configured to obtain a universal coordinated time UTC time corresponding to the mth time when the device enters the running state from the sleep state and a network consumed time corresponding to the UTC time obtaining process;
a second calculating module 414, configured to calculate a second time difference according to the UTC time, the network consumed time, and the first system time;
a third calculating module 416, configured to calculate, according to the first time difference and the second time difference corresponding to the mth time, a timing rate ratio corresponding to the mth time that the device enters the operating state from the sleep state.
In one embodiment, the third calculating module 416 is further configured to calculate a first timing rate ratio according to a ratio of the first time difference to the second time difference; acquiring a historical timing rate ratio obtained by historical calculation; and calculating the first timing rate ratio and the historical timing rate ratio by adopting a smoothing algorithm to obtain the timing rate ratio.
As shown in fig. 6, in an embodiment, the clock correction apparatus further includes:
a first measurement module 418, configured to measure, through an accessed external accurate clock, a first RTC count within a preset time in an operating state of the device;
a second measuring module 420, configured to measure, through an accessed external accurate clock, a second RTC count within a preset time in the device sleep state;
a ratio calculating module 422, configured to calculate the timing rate ratio according to the first RTC count and the second RTC count.
In one embodiment, the first measurement module 418 and the second measurement module 420 are further configured to repeatedly measure the first RTC count and the second RTC count through the external precision clock, and the ratio calculation module is further configured to calculate a ratio of the first RTC count and the second RTC count within each preset time to obtain multiple sets of data; and obtaining a timing rate ratio by adopting a smoothing algorithm on the multiple groups of data.
FIG. 7 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may specifically be a terminal. As shown in fig. 7, the computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement the clock correction method described above. The internal memory may also store a computer program, which when executed by the processor, causes the processor to perform the clock calibration method described above. Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is proposed, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above-mentioned clock correction method.
In an embodiment, a computer-readable storage medium is proposed, in which a computer program is stored which, when being executed by a processor, causes the processor to carry out the steps of the above-mentioned clock correction method.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention. Furthermore, although specific terms are employed herein, they are used in a generic and descriptive sense only and not for purposes of limitation.

Claims (10)

1. A clock correction method, comprising:
acquiring corresponding first system time when the equipment enters a dormant state from an operating state;
acquiring corresponding second system time when the equipment enters an operating state from a dormant state;
acquiring a calibration coefficient, wherein the calibration coefficient is used for indicating a timing rate ratio of the equipment in a running state and a dormant state;
and calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time.
2. The method of claim 1, wherein calibrating the second system time according to the first system time, the second system time, and the calibration coefficient to obtain a calibrated time comprises:
calculating a first time difference between the second system time and the first system time;
calculating to obtain a time adjustment value according to the first time difference and the calibration coefficient;
and determining the calibrated time according to the time adjustment value and the first system time.
3. The method of claim 1, wherein obtaining the calibration coefficients comprises:
when the equipment enters an operation state from a sleep state for the first time, acquiring a preset value as the calibration coefficient;
when the equipment enters the running state from the sleep state for the Nth time, the calibration coefficient is a corresponding timing rate ratio when the equipment enters the running state from the sleep state for the N-1 times, and N is a positive integer greater than 1.
4. The method of claim 3, wherein when the device enters the running state from the sleep state the Mth time, M is a positive integer;
the method further comprises:
calculating a first time difference between the second system time corresponding to the Mth time and the first system time corresponding to the Mth time;
acquiring corresponding universal coordinated time (UTC) time when the equipment enters the running state from the dormant state for the Mth time and network consumed time corresponding to the UTC time acquisition process;
calculating to obtain a second time difference according to the UTC time, the network time consumption and the first system time;
and calculating to obtain a timing rate ratio corresponding to the Mth time when the equipment enters the running state from the sleep state according to the first time difference and the second time difference corresponding to the Mth time.
5. The method of claim 4, wherein the calculating a timing rate ratio corresponding to the mth time of the device entering the running state from the sleep state according to the first time difference and the second time difference corresponding to the mth time comprises:
calculating to obtain a first timing rate ratio according to the ratio of the first time difference to the second time difference;
acquiring a historical timing rate ratio obtained by historical calculation;
and calculating the first timing rate ratio and the historical timing rate ratio by adopting a smoothing algorithm to obtain the timing rate ratio.
6. The method of claim 1, wherein obtaining the calibration coefficients comprises:
measuring a first RTC count of the equipment in a preset time under the running state through an accessed external accurate clock;
measuring a second RTC count of the equipment in a sleep state within a preset time through an accessed external precise clock;
and calculating the timing rate ratio according to the first RTC count and the second RTC count.
7. The method of claim 6, further comprising:
measuring the first RTC count and the second RTC count in a plurality of preset times through the external precision clock, and calculating the ratio of the first RTC count to the second RTC count in each preset time to obtain a plurality of groups of data;
and obtaining the timing rate ratio by adopting a smoothing algorithm on the multiple groups of data.
8. A clock correction apparatus, comprising:
the first acquisition module is used for acquiring corresponding first system time when the equipment enters a dormant state from an operating state;
the second acquisition module is used for acquiring corresponding second system time when the equipment enters the running state from the dormant state;
a third obtaining module, configured to obtain a calibration coefficient, where the calibration coefficient is a timing rate ratio of an indication device in an operating state and a dormant state;
and the calibration module is used for calibrating the second system time according to the first system time, the second system time and the calibration coefficient to obtain calibrated time.
9. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the clock correction method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the clock correction method of any one of claims 1 to 7.
CN202011466731.7A 2020-12-14 2020-12-14 Clock correction method, clock correction device, computer equipment and storage medium Pending CN112462846A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011466731.7A CN112462846A (en) 2020-12-14 2020-12-14 Clock correction method, clock correction device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011466731.7A CN112462846A (en) 2020-12-14 2020-12-14 Clock correction method, clock correction device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112462846A true CN112462846A (en) 2021-03-09

Family

ID=74803154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011466731.7A Pending CN112462846A (en) 2020-12-14 2020-12-14 Clock correction method, clock correction device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112462846A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113050497A (en) * 2021-03-23 2021-06-29 阿尔特汽车技术股份有限公司 Method for timing correction, and corresponding controller, vehicle, device, and medium
CN113934257A (en) * 2021-10-15 2022-01-14 广州极飞科技股份有限公司 System time calculation method, device, equipment and storage medium
CN116909351A (en) * 2023-09-14 2023-10-20 深圳扬兴科技有限公司 Clock chip internal clock precision correction method
WO2024001780A1 (en) * 2022-06-27 2024-01-04 华为技术有限公司 Clock calibration method, electronic device, and computer-readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030076747A1 (en) * 2001-10-19 2003-04-24 Lg Electronics, Inc. Time error compensating apparatus and method in a terminal
KR20070016434A (en) * 2005-08-03 2007-02-08 엘지전자 주식회사 Real time clock apparatus and the real time compensating method thereof
US20090054075A1 (en) * 2007-08-23 2009-02-26 Texas Instruments Incorporated Satellite (gps) assisted clock apparatus, circuits, systems and processes for cellular terminals on asynchronous networks
US20110217935A1 (en) * 2008-11-19 2011-09-08 Huawei Device Co., Ltd Method and Terminal for Acquiring Frequency Difference
CN104917581A (en) * 2015-06-29 2015-09-16 小米科技有限责任公司 System time correction method and device, terminal and router
CN105659673A (en) * 2013-11-04 2016-06-08 高通股份有限公司 Discovery signals in heterogeneous wireless networks
CN111781987A (en) * 2020-07-08 2020-10-16 Oppo广东移动通信有限公司 Real-time clock calibration method and related device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030076747A1 (en) * 2001-10-19 2003-04-24 Lg Electronics, Inc. Time error compensating apparatus and method in a terminal
KR20070016434A (en) * 2005-08-03 2007-02-08 엘지전자 주식회사 Real time clock apparatus and the real time compensating method thereof
US20090054075A1 (en) * 2007-08-23 2009-02-26 Texas Instruments Incorporated Satellite (gps) assisted clock apparatus, circuits, systems and processes for cellular terminals on asynchronous networks
US20110217935A1 (en) * 2008-11-19 2011-09-08 Huawei Device Co., Ltd Method and Terminal for Acquiring Frequency Difference
CN105659673A (en) * 2013-11-04 2016-06-08 高通股份有限公司 Discovery signals in heterogeneous wireless networks
CN104917581A (en) * 2015-06-29 2015-09-16 小米科技有限责任公司 System time correction method and device, terminal and router
CN111781987A (en) * 2020-07-08 2020-10-16 Oppo广东移动通信有限公司 Real-time clock calibration method and related device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113050497A (en) * 2021-03-23 2021-06-29 阿尔特汽车技术股份有限公司 Method for timing correction, and corresponding controller, vehicle, device, and medium
CN113934257A (en) * 2021-10-15 2022-01-14 广州极飞科技股份有限公司 System time calculation method, device, equipment and storage medium
WO2024001780A1 (en) * 2022-06-27 2024-01-04 华为技术有限公司 Clock calibration method, electronic device, and computer-readable storage medium
CN116909351A (en) * 2023-09-14 2023-10-20 深圳扬兴科技有限公司 Clock chip internal clock precision correction method
CN116909351B (en) * 2023-09-14 2023-12-19 深圳扬兴科技有限公司 Clock chip internal clock precision correction method

Similar Documents

Publication Publication Date Title
CN112462846A (en) Clock correction method, clock correction device, computer equipment and storage medium
CN106802935B (en) Page fluency testing method and device
CN107870652A (en) Sensor clock method of estimation and its device
CN1965270B (en) Measuring clock jitter
CN110139236B (en) Synchronous acquisition method based on wireless sensor network
CN114623939A (en) Method, device, equipment and medium for determining pulse frequency
CN110595502A (en) Running distance estimation method and device
CN114047380A (en) Electric energy metering method and device and electric energy meter
CN115866154B (en) Time delay measurement method, device and system of vehicle-mounted multi-camera system and automobile
CN108159677B (en) Motion data statistical method, electronic device and computer readable storage medium
CN112767434A (en) Step length obtaining method and electronic equipment
CN115298636A (en) Method and device for measuring power of processor core
CN112737574B (en) Timing calibration method and related device for clock source in chip
CN108784748A (en) A kind of method, apparatus and electronic equipment on predicting ovulation date
US11442087B2 (en) Adaptive power measurement accumulator with a changing sampling frequency
CN111189471A (en) Correction method, correction device and computer storage medium
CN106547710A (en) It is a kind of based on the task timing of 1553B buses RTC time and analysis method on machine
CN111510236A (en) High-voltage current monitoring time synchronization system and time synchronization method
CN116125777A (en) Timing method, device, equipment and storage medium
CN111124452A (en) Software upgrading method and device for instrument, instrument and storage medium
JP4353682B2 (en) Flow rate measuring method and apparatus
CN115563015B (en) Code heat statistics method, device, equipment and storage medium
CN113271168B (en) Power distribution network clock synchronization implementation method based on satellite common view
CN112098867B (en) Method, device and medium for determining remaining capacity and capacity display information of battery
JPH06160530A (en) Counting rate meter

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination