CN113110697B - Time calibration method, device, equipment and storage medium - Google Patents

Time calibration method, device, equipment and storage medium Download PDF

Info

Publication number
CN113110697B
CN113110697B CN202110409092.9A CN202110409092A CN113110697B CN 113110697 B CN113110697 B CN 113110697B CN 202110409092 A CN202110409092 A CN 202110409092A CN 113110697 B CN113110697 B CN 113110697B
Authority
CN
China
Prior art keywords
time
time value
value
validity
calibration
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.)
Active
Application number
CN202110409092.9A
Other languages
Chinese (zh)
Other versions
CN113110697A (en
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.)
Shenzhen Fushikang Intelligent Co ltd
Original Assignee
Shenzhen Fushikang Intelligent Co ltd
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 Shenzhen Fushikang Intelligent Co ltd filed Critical Shenzhen Fushikang Intelligent Co ltd
Priority to CN202110409092.9A priority Critical patent/CN113110697B/en
Publication of CN113110697A publication Critical patent/CN113110697A/en
Application granted granted Critical
Publication of CN113110697B publication Critical patent/CN113110697B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)

Abstract

The invention discloses a time calibration method, a time calibration device, time calibration equipment and a storage medium, and belongs to the technical field of time calibration. The time calibration method comprises the steps of initializing a physical memory area where a time black box is located; reading a plurality of time black box parameters in the initialized physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values; determining the validity of the physical memory area according to the characteristic value; determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area; calculating a calibration time value according to the validity of the time value and the valid time value; and calibrating the current system time according to the calibration time value. The time calibration method can conveniently calibrate the system time so as to ensure that the system time of the terminal equipment without the RTC chip has better accuracy after restarting.

Description

Time calibration method, device, equipment and storage medium
Technical Field
The present invention relates to the field of time calibration technologies, and in particular, to a time calibration method, apparatus, device, and storage medium.
Background
At present, in order to save hardware cost or consider other factors, a Real Time Clock (RTC) chip is not configured in many terminal devices, and the advantages of such terminal devices are that non-power-off restarting is required due to network abnormality and the like, and the accuracy of the system Time is affected because the system Time cannot be synchronized after restarting, so how to provide a Time calibration method can ensure that the system Time of the terminal device without the RTC chip has better accuracy after restarting becomes a problem to be solved urgently.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art. Therefore, the invention provides a time calibration method which can conveniently calibrate the system time so as to ensure that the system time of the terminal equipment which is not configured with the RTC chip has better accuracy after restarting.
The invention also provides a time calibration device with the time calibration method.
The invention also provides electronic equipment with the time calibration method.
The invention also proposes a computer readable storage medium.
An embodiment of a time alignment method according to the first aspect of the present invention includes:
Initializing a physical memory area where the time black box is located;
Reading a plurality of initialized time black box parameters in the physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values;
determining the validity of the physical memory area according to the characteristic value;
Determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area;
Calculating a calibration time value according to the validity of the time value and the valid time value;
And calibrating the current system time according to the calibration time value.
The time calibration method according to the embodiment of the invention has at least the following beneficial effects: according to the time calibration method, the physical memory area where the time black box is located is initialized, and a plurality of time black box parameters in the physical memory area are read, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, the validity of the physical memory area is determined according to the characteristic values, after the validity of the physical memory area is determined, the validity of the time values and the valid time values are determined according to the actual checksums of the time values and the time values, so that the calibration time value can be conveniently calculated according to the valid time values after the validity of the time values are determined, the current system time is calibrated, and the system time can be conveniently calibrated, so that the system time of the terminal equipment without the RTC chip is guaranteed to have good accuracy after the restarting.
According to some embodiments of the invention, the determining the validity of the physical memory area according to the feature value includes:
If the characteristic value is inconsistent with the preset characteristic value, determining the physical memory area as an invalid area;
initializing the physical memory area where the time black box is located again, and writing in the preset characteristic value;
The time value is set to an initial time value.
According to some embodiments of the invention, the determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value, and the validity of the physical memory area includes:
Calculating a calculation checksum of the time value according to the time value and a data verification algorithm;
and determining the validity of the time value and the valid time value according to the calculated checksum and the actual checksum.
According to some embodiments of the invention, the calculating the calibration time value according to the validity of the time value and the valid time value includes:
Calculating a calibration time value according to the validity of the time value, the valid time value and a calculation formula;
Wherein, the calculation formula is t=t1+t2, T is a calibration time value, T1 is an effective time value, and T2 is a preset time calibration factor.
According to some embodiments of the invention, the calibrating the current system time according to the calibration time value includes:
Acquiring the current networking state of the IPC equipment;
acquiring current standard time according to the networking state of the IPC equipment, wherein the standard time is UTC time;
and according to the current UTC time, inputting the calibration time value to calibrate the current system time.
According to some embodiments of the invention, after calibrating the current system time according to the calibration time value, the method further comprises:
Re-acquiring the current system time after each preset time period;
and updating a plurality of time black box parameters of the time black box according to the re-acquired current system time.
According to some embodiments of the invention, the updating the plurality of time black box parameters of the time black box according to the current system time acquired again further includes:
if the IPC equipment is monitored to restart, reading the reference system time of the IPC equipment before the restarting occurs;
and calibrating the current system time according to the reference system time of the IPC equipment before the restart and the time calibration method.
According to an embodiment of the second aspect of the present invention, a time calibration apparatus includes:
the initialization module is used for initializing a physical memory area where the time black box is located;
The parameter reading module is used for reading a plurality of initialized time black box parameters in the physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values;
The first verification module is used for determining the validity of the physical memory area according to the characteristic value;
the second checking module is used for determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area;
the calculating module is used for calculating a calibration time value according to the validity of the time value and the valid time value;
and the time calibration module is used for calibrating the current system time according to the calibration time value.
The time calibration device provided by the embodiment of the invention has at least the following beneficial effects: the time calibration device initializes a physical memory area where a time black box is located through an initialization module, and a parameter reading module reads a plurality of time black box parameters in the physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, a first checking module determines the validity of the physical memory area according to the characteristic values, and after the validity of the physical memory area is determined, a second checking module determines the validity of the time values and the valid time values according to the actual checksums of the time values and the time values, so that a calculating module can conveniently calculate a calibration time value according to the valid time values after the validity of the time values is determined, and the time calibration module calibrates the system time conveniently, so that the system time of a terminal device without a chip RTC is ensured to have better accuracy after restarting.
An electronic device according to an embodiment of a third aspect of the present invention includes:
At least one processor, and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions that are executed by the at least one processor to cause the at least one processor to implement the time alignment method as described in the embodiments of the first aspect when the instructions are executed.
The electronic equipment provided by the embodiment of the invention has at least the following beneficial effects: the electronic equipment adopts the time calibration method, and the time black box is initialized through the physical memory area where the time black box is located, and a plurality of time black box parameters in the physical memory area are read, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, the validity of the physical memory area is determined according to the characteristic values, after the validity of the physical memory area is determined, the validity of the time values and the valid time values are determined according to the actual checksums of the time values and the time values, so that the calibration time value can be conveniently calculated according to the valid time values after the validity of the time values is determined, and the system time can be conveniently calibrated, so that the system time of the terminal equipment without the RTC chip is ensured to have better accuracy after the restarting.
A computer-readable storage medium according to an embodiment of the fourth aspect of the present invention stores computer-executable instructions for causing a computer to perform the time alignment method according to the embodiment of the first aspect.
The computer-readable storage medium according to the embodiment of the invention has at least the following advantageous effects: the computer readable storage medium executes the time calibration method, and the time black box is initialized in the physical memory area, and a plurality of time black box parameters in the physical memory area are read, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, the validity of the physical memory area is determined according to the characteristic values, and after the validity of the physical memory area is determined, the validity of the time values and the valid time values are determined according to the actual checksums of the time values and the time values, so that the calibration time values can be conveniently calculated according to the valid time values after the validity of the time values are determined, and the system time can be conveniently calibrated, so that the system time of the terminal equipment without the RTC chip is ensured to have better accuracy after restarting.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The invention is further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flow chart of a time alignment method according to an embodiment of the invention;
FIG. 2 is a flow chart of a time alignment method according to another embodiment of the present invention;
FIG. 3 is a flow chart of a time alignment method according to another embodiment of the present invention;
FIG. 4 is a flowchart of a time alignment method according to another embodiment of the present invention;
FIG. 5 is a flowchart of a time alignment method according to another embodiment of the present invention;
FIG. 6 is a flowchart of a time alignment method according to another embodiment of the present invention;
FIG. 7 is a flowchart of a time alignment method according to another embodiment of the present invention;
fig. 8 is a schematic structural diagram of a time alignment apparatus according to an embodiment of the invention.
Reference numerals: 810. initializing a module; 820. a parameter reading module; 830. a first verification module; 840. a second checking module; 850. a computing module; 860. a time calibration module; 870. and a circulation module.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention.
In the description of the present invention, it should be understood that references to orientation descriptions such as upper, lower, front, rear, left, right, etc. are based on the orientation or positional relationship shown in the drawings, are merely for convenience of description of the present invention and to simplify the description, and do not indicate or imply that the apparatus or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus should not be construed as limiting the present invention.
In the description of the present invention, the meaning of a number is one or more, the meaning of a number is two or more, and greater than, less than, exceeding, etc. are understood to exclude the present number, and the meaning of a number is understood to include the present number. The description of the first and second is for the purpose of distinguishing between technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless explicitly defined otherwise, terms such as arrangement, installation, connection, etc. should be construed broadly and the specific meaning of the terms in the present invention can be reasonably determined by a person skilled in the art in combination with the specific contents of the technical scheme.
In the description of the present invention, the descriptions of the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
In a first aspect, referring to fig. 1, a time calibration method according to an embodiment of the present invention includes:
s100, initializing a physical memory area where a time black box is located;
s200, reading a plurality of time black box parameters in the initialized physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values;
s300, determining the validity of the physical memory area according to the characteristic value;
S400, determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area;
s500, calculating a calibration time value according to the validity of the time value and the valid time value;
s600, calibrating the current system time according to the calibration time value.
In the process of calibrating the system time, firstly, powering on and starting an IPC device (i.e. a network camera), loading an embedded operating system, initializing a physical content area where a time black box is located, and reading a plurality of time black box parameters in the initialized physical memory area, wherein the time black box parameters comprise a characteristic value, a time value and an actual checksum of the time value, and the characteristic value is a MAGIC number MAGIC, namely a characteristic identifier of the time black box; the Time value Time can be set as a UNIX Time stamp or other Time formats, without limitation; the actual Checksum of the time value Checksum is mainly used for checking the sum of a plurality of time values, and the actual Checksum of the time value is directly read from the time black box. Thus, whether the physical storage area is effective or not can be determined according to the characteristic value, when the physical storage area is an effective area, the validity of the time value is verified according to the time value and the actual checksum of the time value, specifically, the time value can be calculated according to a data verification algorithm to obtain the calculated checksum of the time value, and whether the time value is effective or not is determined according to the consistency of the calculated checksum and the actual checksum, for example, when the calculated checksum is equal to the actual checksum, the time value is effective, and the effective time value is obtained at the same time, so that the calibration time value can be calculated according to the effective time value and the time calibration factor, and the current system time is calibrated according to the calibration time value, so that the terminal equipment without the RTC chip can be conveniently calibrated to the current system time after restarting, and the accuracy of the system time is improved.
Referring to fig. 2, in some embodiments, step S300 includes:
S310, if the characteristic value is consistent with a preset characteristic value, determining the physical memory area as an effective area;
Or alternatively
S320, if the characteristic value is inconsistent with the preset characteristic value, determining that the physical memory area is an invalid area;
S330, initializing the physical memory area where the time black box is located again, and writing in a preset characteristic value;
s340, the time value is set as the initial time value.
When the validity of the physical memory area is verified, the physical memory area is indicated to be an invalid area if the characteristic value is identical (equal or same) with the preset characteristic value, and the physical memory area is not satisfied with the time calibration requirement if the characteristic value is not identical with the preset characteristic value, and the time value is set to be an initial time value.
Referring to fig. 3, in some embodiments, step S400 includes:
s410, calculating a calculation checksum of the time value according to the time value and a data verification algorithm;
s420, determining validity of the time value and the valid time value according to the calculated checksum and the actual checksum.
In the process of checking the validity of the time value, the time value is often calculated through a data verification algorithm to obtain a calculated checksum of the time value, for example, the calculated checksum of the time value can be calculated through a cyclic redundancy check algorithm (i.e. a crc checksum algorithm), the calculated checksum and the actual checksum are compared, when the calculated checksum and the actual checksum are equal, the verification is passed, the time value is valid, the valid time value is obtained, and when the calculated checksum and the actual checksum are not equal, the verification is failed, and the time value is invalid. In order to calibrate the system time, a plurality of sets of time values and checksums of the time values are often selected, and validity of each set of time values is verified, at this time, when the plurality of time values are found to be valid, the time value with the largest number of sets of time values is used as a valid time value, for example, when five sets of time values and checksums of the time values are selected, the sets of time values are marked as a set, B set, C set, D set, and E set, wherein the two sets of time values of the a set and the B set are identical, whether the time values of each set are valid is verified, and the time values corresponding to the sets of time values of the a set, the B set, the C set, and the D set are verified, at this time, the time value corresponding to the set of time values of the a set and the B set is selected as a valid time value.
In some embodiments, step S500 includes:
Calculating a calibration time value according to the validity of the time value, the valid time value and a calculation formula;
Wherein, the calculation formula is t=t1+t2, T is a calibration time value, T1 is an effective time value, and T2 is a preset time calibration factor.
After the effective time value is obtained, a calibration time value can be calculated according to the effective time value and a calculation formula, wherein the calculation formula is t=t1+t2, T is the calibration time value, T1 is the effective time value, T2 is a preset time calibration factor, and it is to be explained that the calibration time value T is the current approximate time of the system, so that the calibration time value T can be used as the current system time after restarting; t1 is an effective time value, which is a time value read from a time black box and represents the system time before restarting; t2 is a preset time calibration factor, which is an estimated value of the starting time of the system restart, so that a calibration time value, namely the current system time after the restart, can be conveniently calculated according to a calculation formula and an effective time value, and the current system time can be calibrated according to the calibration time value, so that the current system time is synchronized.
Referring to fig. 4, in some embodiments, step S600 includes:
S610, acquiring the current networking state of the IPC equipment;
s620, acquiring current standard time according to the networking state of the IPC equipment, wherein the standard time is UTC time;
s630, according to the current UTC time, a calibration time value is input to calibrate the current system time.
After the calibration time value is obtained, the current networking state of the IPC device is required to be obtained, the IPC device is confirmed to be in the networking state, namely, the IPC device is connected with the Internet, the current standard time is obtained from the time server, wherein the standard time is UTC time (namely, universal time, universal standard time and international coordinated time), so that the setting and calibration of the current system time are completed according to the current UTC time, the time value in the time black box is updated, the current system time can be conveniently calibrated after the terminal device (the IPC device) which is not configured with the RTC chip is restarted, the synchronization of the current system time is achieved, and the accuracy of the current system time is improved.
Referring to fig. 5, in some embodiments, after step S600, further includes:
s700, re-acquiring the current system time after each preset time period;
S800, updating a plurality of time black box parameters of the time black box according to the re-acquired current system time.
In order to ensure the synchronism of the current system time, after the calibration of the current system time, the current system time can be re-acquired after each preset time period, and according to the re-acquired current system time, a plurality of time black box parameters of the time black box are updated, so that more accurate effective time values are acquired after each preset time period, thereby calibrating the current system time, and ensuring the synchronism of the current system time, for example, the current system time can be acquired every 1 to 10 seconds and written into the time black box, and particularly, when the current system time is written, the actual checksum of a plurality of time values and corresponding time values can be sequentially and repeatedly written into the time black box, for example, the system time can be acquired every 1 second and the actual checksum of 3 time values and corresponding time values can be sequentially and repeatedly written into the time black box, so that the accuracy of the effective time values obtained later can be ensured, and the accuracy of the calibration of the current system time can be ensured.
Referring to fig. 6, in some embodiments, step S800 further includes:
S810, if the IPC equipment is detected to restart, reading the reference system time of the IPC equipment before the restart occurs;
s820, calibrating the current system time according to the reference system time and the time calibration method of the IPC device before the restart occurs.
In the working process of the IPC equipment, when normal or abnormal non-outage restarting of the IPC equipment is monitored, the reference system time of the IPC equipment before the restarting is read, wherein the reference system time before the restarting is an effective time value, namely, the current system time can be conveniently calibrated according to the reference system time and the time calibration method of the IPC equipment before the restarting, so that the system time of the IPC equipment can be kept synchronous, and the working stability of the IPC equipment is improved.
With reference to fig. 7, the time alignment method is described below in one specific embodiment, it being understood that the following description is merely exemplary and not a specific limitation of the present application.
In the process of calibrating the current system time, firstly powering on and starting the IPC equipment (i.e. the network camera), loading an embedded operating system, initializing a physical content area where a time black box is located, and reading time black box parameters in the initialized physical memory area, wherein the time black box parameters comprise a characteristic value MAGIC; according to the characteristic value, whether the physical memory area is effective or not can be determined, specifically, when the validity check is carried out on the physical memory area, the characteristic value is compared with a preset characteristic value, namely if the characteristic value is consistent (equal or same) with the preset characteristic value, the physical memory area is indicated to be an effective area, if the characteristic value is inconsistent with the preset characteristic value, the physical memory area is indicated to be an ineffective area, the requirement of time calibration is not met, the physical memory area where the time black box is located is required to be initialized again, the preset characteristic value is written, and meanwhile, the time value is set to be the reference system time of the IPC equipment before non-power-off restarting; when the physical storage area is an effective area, three groups of time values and the actual checksums of the corresponding time values in the time black box parameters in the physical memory area are read, the validity of the time values is verified according to the time values and the actual checksums of the time values, the calculated checksums of the time values can be calculated through a cyclic redundancy check algorithm (i.e. a crc checksum algorithm), the calculated checksums and the actual checksums are compared, when the two are equal, the verification is passed, the time values are valid, the time values are taken as effective time values, if the calculated checksums and the actual checksums are unequal, the verification is not passed, the time values are invalid, and when a plurality of time values are found to be valid, the time value with the largest group number of the same time values is taken as the effective time value; after obtaining the effective time value, calculating a calibration time value according to the effective time value and a calculation formula, wherein the calculation formula is t=t1+t2, T is the calibration time value, T1 is the effective time value, T2 is a preset time calibration factor, after obtaining the calibration time value, acquiring the current networking state of the IPC equipment, confirming that the IPC equipment is in the networking state, and acquiring the current standard time from a time server, wherein the standard time is UTC time, so that the calibration time value is input according to the current UTC time, the setting and calibration of the system time are completed, and meanwhile, the current system time is acquired again after each preset time period; and updating a plurality of time black box parameters of the time black box according to the newly acquired current system time, so that the current system time can be conveniently calibrated, the system time of the IPC equipment can be ensured to be kept synchronous, and the working stability of the IPC equipment is improved.
Second aspect, referring to fig. 8, a time calibration apparatus according to an embodiment of the present invention includes:
An initialization module 810, configured to initialize a physical memory area where the time black box is located;
A parameter reading module 820, configured to read a plurality of time black box parameters in the initialized physical memory area, where the time black box parameters include a feature value, a time value, and an actual checksum of the time value;
a first checking module 830, configured to determine the validity of the physical memory area according to the feature value;
a second checking module 840, configured to determine the validity of the time value and the valid time value according to the time value, the actual checksum of the time value, and the validity of the physical memory area;
A calculating module 850, configured to calculate a calibration time value according to the validity of the time value and the valid time value;
the time calibration module 860 is configured to calibrate the current system time according to the calibration time value.
In the process of calibrating the system time, the IPC device is first powered on and an embedded operating system is loaded, and then the initialization module 810 initializes a physical content area where the time black box is located, and the parameter reading module 820 reads a plurality of time black box parameters in the physical memory area, where the time black box parameters include a feature value, a time value and an actual checksum of the time value, so that the first calibration module 830 can determine whether the physical memory area is valid according to the feature value, when the physical memory area is a valid area, the second calibration module 840 can verify the validity of the time value according to the actual checksum of the time value and the time value, specifically, can calculate the time value according to a data calibration algorithm, to obtain a calculated checksum of the time value, and determine whether the time value is valid according to the consistency of the calculated checksum and the actual checksum, for example, when the calculated checksum is equal to the actual checksum, the time value is valid, and the valid time value is obtained, so that the calculation module 850 can calculate the calibration time value according to the valid time value and the time calibration factor, so that the time calibration module 860 can conveniently calibrate the current chip according to the time of the system, and the system can not be configured by the current chip.
Referring to fig. 8, in some embodiments, the time alignment apparatus further comprises:
A loop module 870 for re-acquiring the current system time after each predetermined time period, and updating a plurality of time black box parameters of the time black box according to the re-acquired current system time.
In order to ensure the synchronism of the system time, the circulation module 870 may further re-acquire the current system time after performing the calibration of the current system time for each predetermined time period, update the plurality of time black box parameters of the time black box according to the re-acquired current system time, so as to acquire more accurate valid time values after each predetermined time period, thereby calibrating the current system time, ensuring the synchronism of the system time, for example, the current system time may be acquired every 1 to 10 seconds and written into the time black box, and in particular, when writing the current system time, the actual checksum of the plurality of time values and the corresponding time values may be sequentially and repeatedly written, for example, the current system time may be acquired every 1 second and the actual checksum of the 3 time values and the corresponding time values may be sequentially and repeatedly written, so that the accuracy of the valid time values obtained later may be ensured, thereby ensuring the accuracy of the calibration of the system time. Meanwhile, in the working process of the IPC equipment, when normal or abnormal non-outage restarting of the IPC equipment is monitored, the reference system time of the IPC equipment before the restarting is read, wherein the reference system time before the restarting is an effective time value, namely, the current system time can be conveniently calibrated according to the reference system time and the time calibration method of the IPC equipment before the restarting, so that the system time of the IPC equipment can be kept synchronous, and the working stability of the IPC equipment is improved.
In a third aspect, an electronic device according to an embodiment of the present invention includes at least one processor, and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions that are executed by the at least one processor to cause the at least one processor to perform a time alignment method as in the embodiments of the first aspect when the instructions are executed.
The electronic equipment provided by the embodiment of the invention has at least the following beneficial effects: the electronic equipment adopts the time calibration method, and the time black box is initialized through the physical memory area where the time black box is located, and a plurality of time black box parameters in the physical memory area are read, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, the validity of the physical memory area is determined according to the characteristic values, after the validity of the physical memory area is determined, the validity of the time values and the valid time values are determined according to the actual checksums of the time values and the time values, so that the calibration time value can be conveniently calculated according to the valid time values after the validity of the time values is determined, the current system time can be calibrated, and the system time of the terminal equipment which is not configured with the RTC chip can be conveniently calibrated, so that the system time after restarting has better accuracy.
In a fourth aspect, the present invention also proposes a computer readable storage medium. The computer-readable storage medium stores computer-executable instructions for causing a computer to perform a time alignment method as an embodiment of the first aspect.
The computer-readable storage medium according to the embodiment of the invention has at least the following advantageous effects: the computer readable storage medium executes the time calibration method, and the time black box is initialized in the physical memory area, and a plurality of time black box parameters in the physical memory area are read, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values, the validity of the physical memory area is determined according to the characteristic values, and after the validity of the physical memory area is determined, the validity of the time values and the valid time values are determined according to the actual checksums of the time values and the time values, so that the calibration time value can be conveniently calculated according to the valid time values after the validity of the time values is determined, the current system time can be calibrated, and the current system time can be conveniently calibrated, so that the system time of the terminal equipment without the RTC chip is ensured to have better accuracy after the restarting.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of one of ordinary skill in the art without departing from the spirit of the present invention. Furthermore, embodiments of the invention and features of the embodiments may be combined with each other without conflict.

Claims (8)

1. A method of time alignment, comprising:
Initializing a physical memory area where the time black box is located;
Reading a plurality of initialized time black box parameters in the physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values;
determining the validity of the physical memory area according to the characteristic value;
Determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area;
Calculating a calibration time value according to the validity of the time value and the valid time value;
Calibrating the current system time according to the calibration time value;
Wherein the determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area includes:
Calculating a calculation checksum of the time value according to the time value and a data verification algorithm;
comparing the calculated checksum with the actual checksum;
when the calculated checksum and the actual checksum are equal, determining that the validity verification of the time value is passed, the time value is valid, and determining a valid time value based on the time value;
If the calculated checksum and the actual checksum are not equal, determining that the validity verification of the time value is not passed, wherein the time value is invalid;
and calculating a calibration time value according to the validity of the time value and the valid time value, wherein the method comprises the following steps of:
Calculating a calibration time value according to the validity of the time value, the valid time value and a calculation formula;
Wherein, the calculation formula is t=t1+t2, T is a calibration time value, T1 is an effective time value, and T2 is a preset time calibration factor.
2. The method of time alignment according to claim 1, wherein determining the validity of the physical memory area according to the characteristic value comprises:
If the characteristic value is inconsistent with the preset characteristic value, determining the physical memory area as an invalid area;
initializing the physical memory area where the time black box is located again, and writing in the preset characteristic value;
The time value is set to an initial time value.
3. The time alignment method according to claim 1, wherein said aligning the current system time based on the alignment time value comprises:
Acquiring the current networking state of the IPC equipment;
acquiring current standard time according to the networking state of the IPC equipment, wherein the standard time is UTC time;
and according to the current UTC time, inputting the calibration time value to calibrate the current system time.
4. A time alignment method according to any of claims 1 to 3, wherein after the alignment of the current system time according to the alignment time value, further comprising:
Re-acquiring the current system time after each preset time period;
and updating a plurality of time black box parameters of the time black box according to the re-acquired current system time.
5. The method of time alignment according to claim 4, wherein updating the plurality of time black box parameters of the time black box according to the current system time acquired again, further comprises:
if the IPC device is detected to restart, reading the reference system time of the IPC device before the restart occurs, wherein the reference system time before the restart occurs is the effective time value;
and calibrating the current system time according to the reference system time of the IPC equipment before the restart and the time calibration method.
6. Time calibration device, characterized in that it comprises:
the initialization module is used for initializing a physical memory area where the time black box is located;
The parameter reading module is used for reading a plurality of initialized time black box parameters in the physical memory area, wherein the time black box parameters comprise characteristic values, time values and actual checksums of the time values;
The first verification module is used for determining the validity of the physical memory area according to the characteristic value;
the second checking module is used for determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area;
the calculating module is used for calculating a calibration time value according to the validity of the time value and the valid time value;
the time calibration module is used for calibrating the current system time according to the calibration time value;
Wherein the determining the validity of the time value and the valid time value according to the time value, the actual checksum of the time value and the validity of the physical memory area includes:
Calculating a calculation checksum of the time value according to the time value and a data verification algorithm;
comparing the calculated checksum with the actual checksum;
when the calculated checksum and the actual checksum are equal, determining that the validity verification of the time value is passed, the time value is valid, and determining a valid time value based on the time value;
If the calculated checksum and the actual checksum are not equal, determining that the validity verification of the time value is not passed, wherein the time value is invalid;
and calculating a calibration time value according to the validity of the time value and the valid time value, wherein the method comprises the following steps of:
Calculating a calibration time value according to the validity of the time value, the valid time value and a calculation formula;
Wherein, the calculation formula is t=t1+t2, T is a calibration time value, T1 is an effective time value, and T2 is a preset time calibration factor.
7. An electronic device, comprising:
At least one processor, and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions for execution by the at least one processor to cause the at least one processor to implement the time alignment method of any of claims 1-5 when executing the instructions.
8. Computer readable storage medium, characterized in that it stores computer executable instructions for causing a computer to perform the time calibration method according to any one of claims 1 to 5.
CN202110409092.9A 2021-04-16 2021-04-16 Time calibration method, device, equipment and storage medium Active CN113110697B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110409092.9A CN113110697B (en) 2021-04-16 2021-04-16 Time calibration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110409092.9A CN113110697B (en) 2021-04-16 2021-04-16 Time calibration method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113110697A CN113110697A (en) 2021-07-13
CN113110697B true CN113110697B (en) 2024-06-18

Family

ID=76717970

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110409092.9A Active CN113110697B (en) 2021-04-16 2021-04-16 Time calibration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113110697B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394715A (en) * 2011-06-30 2012-03-28 中兴通讯股份有限公司 Method and device for synchronizing clocks
CN104915269A (en) * 2015-07-09 2015-09-16 广东欧珀移动通信有限公司 Mobile terminal time and date information setting method and apparatus and mobile terminal

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005031576A2 (en) * 2003-09-23 2005-04-07 Revivio, Inc. Systems and methods for time dependent data storage and recovery
US7870411B2 (en) * 2006-07-17 2011-01-11 Xensource, Inc. Tracking current time on multiprocessor hosts and virtual machines
US20150127284A1 (en) * 2013-11-03 2015-05-07 Microsoft Corporation Sensor Data Time Alignment
CN107844714B (en) * 2017-11-01 2021-04-09 深信服科技股份有限公司 Verification method and device, computer device and readable storage medium
CN109542350A (en) * 2018-11-20 2019-03-29 大连理工大学 A kind of SD card rapid access method based on time index
CN111367569B (en) * 2018-12-26 2023-04-28 合肥杰发科技有限公司 Memory calibration system and method and readable storage medium
CN112632642B (en) * 2020-12-28 2022-05-20 北京深思数盾科技股份有限公司 Clock checking method and device and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394715A (en) * 2011-06-30 2012-03-28 中兴通讯股份有限公司 Method and device for synchronizing clocks
CN104915269A (en) * 2015-07-09 2015-09-16 广东欧珀移动通信有限公司 Mobile terminal time and date information setting method and apparatus and mobile terminal

Also Published As

Publication number Publication date
CN113110697A (en) 2021-07-13

Similar Documents

Publication Publication Date Title
US7877596B2 (en) Method and computer product to increase accuracy of time-based software verification for sensor networks
US20110320794A1 (en) Flash System And Method For Updating The Flash System
CN112650520B (en) Ammeter upgrading method and system, intelligent ammeter and storage medium
CN104572320A (en) Method for confirming correction program and information processing apparatus
CN107861833B (en) Method and device for generating identification code, computer equipment and readable storage medium
EP4075309A1 (en) Secure boot device
CN113110697B (en) Time calibration method, device, equipment and storage medium
CN117318869A (en) Message time stamp verification method, electronic equipment and storage medium
CN117687695A (en) Information processing method, information processing device, electronic equipment and storage medium
CN112636984A (en) Federation chain configuration updating method, equipment and computer medium
CN110716823B (en) System and method for continuously verifying device state integrity
CN114827967B (en) Software updating method, bluetooth device and storage medium
CN114595460A (en) Signature firmware verification method, device and computer readable medium
CN117076201A (en) Data processing method, device, equipment and computer readable storage medium
CN111538371A (en) Real-time clock device, working method thereof and USB (universal serial bus) equipment
CN111277353B (en) System time deviation correction processing method and device, computer equipment and medium
JP5286831B2 (en) Measuring device
CN110795339A (en) Method, device and medium for testing configuration program code of server
TW201423048A (en) Multi-sensing-elements calibration system, calibration method and recording medium
CN114124401B (en) Data authentication method, device, equipment and storage medium
TWI760703B (en) Data restoration method, module and display device
CN117390690A (en) Data processing method, device, equipment and storage medium
CN104657166B (en) server system and node replacement method
JP3436846B2 (en) Communication method with packet order information
CN117076212B (en) Consistency check method, device, medium and equipment for MPI communication data content

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
GR01 Patent grant
GR01 Patent grant