Clock calibration method and device, equipment and storage medium
By acquiring network time data and system time data and performing progressive and step-by-step calibration, the second jump and fallback problems of clock synchronization in embedded systems are solved, and a higher precision clock calibration is achieved.
Patent Information
- Application Number
- CN202510199858.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-07-18
AI Technical Summary
In the prior art, the embedded system has problems of inaccurate crystal oscillator frequency, influence of power supply, increase in cost, and time jumps and fallbacks caused by NTP synchronization during clock synchronization, especially in environments where network signals are weak or delayed, which affects the normal operation of the system.
By obtaining network time data and system time data, when the network synchronization is normal, the clock calibration data is determined and progressive and step-by-step calibration is performed until the time difference between the system time data and the network time data meets the preset conditions to avoid seconds jumping and backing.
Improve the accuracy of clock calibration, avoid the jump and fallback of system time data during calibration, and ensure the stability and accuracy of system time.
Smart Images

Figure CN120342532A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a clock calibration method, apparatus, device, and storage medium. Background Art
[0002] Currently, the embedded system mainly uses two methods for clock synchronization: the Network Time Protocol (NTP) and the Real-Time Clock (RTC) chip. Among them, the real-time clock chip is usually called the hardware clock. However, in the process of using the RTC hardware clock for clock synchronization, the clock synchronization application is affected by factors such as inaccurate crystal oscillator frequency, power supply, and increased cost. Further, in the process of using NTP for clock synchronization, the network time obtained is usually directly set as the system local time during NTP calibration. Forcing the synchronization of time will cause a large jump in time, resulting in phenomena such as leap seconds or even time rollback, leading to unknown risks in the system. At the same time, although NTP provides a fine-tuning method for slow time synchronization, there are still problems such as limited fine-tuning range and long fine-tuning process, resulting in inaccurate system time for a long time, affecting the normal operation of the system. Moreover, the NTP synchronization time is restricted by factors such as system resource occupancy and network environment quality. Frequent time synchronization will affect the processing of the main tasks of the system. However, most embedded system CPUs have limited resources. Especially in an environment with weak network signals or large delays, frequent NTP requests will cause blockages and occupy a large amount of system and network resources. Summary of the Invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a technical solution for a clock calibration method, apparatus, computer device, and storage medium. That is, the present application obtains network time data and system time data of a target device, and when the network time data represents normal network synchronization, determines clock calibration data according to the network time data and the system time data. The clock calibration data is used to calibrate the system time data, so as to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition. The preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold. Using the technical solution provided by the present application can avoid the occurrence of leap seconds and rollback of the system time data during the clock calibration process, thereby improving the clock calibration accuracy.
[0004] On the one hand, the embodiments of the present application provide a clock calibration method, and the method includes:
[0005] Obtain network time data and system time data of a target device;
[0006] When the network time data represents normal network synchronization, determine clock calibration data according to the network time data and the system time data, where the clock calibration data is used to calibrate the system time data;
[0007] Perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold.
[0008] Further, the determining the clock calibration data according to the network time data and the system time data includes:
[0009] Determine the time difference between the network time data and the system time data according to the network time data and the system time data;
[0010] Determine the clock calibration data according to the absolute value of the time difference and a preset time difference threshold.
[0011] Further, the preset time difference threshold includes a first preset time difference sub-threshold, a second preset time difference sub-threshold, and a third preset time difference sub-threshold, where the first preset time difference sub-threshold is less than the second preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold;
[0012] Correspondingly, the determining the clock calibration data according to the absolute value of the time difference and the preset time difference threshold includes:
[0013] When the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold, determine the clock calibration data as the network time data;
[0014] When the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, determine the clock calibration data as a first preset clock calibration value;
[0015] When the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, determine the clock calibration data as a second preset clock calibration value, where the second preset clock calibration value is less than the first preset clock calibration value;
[0016] When the absolute value of the time difference is less than the third preset time difference sub-threshold, the clock calibration data is determined as the third preset clock calibration value, and the third preset clock calibration value is less than the second preset clock calibration value.
[0017] Further, the clock calibration of the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets the preset time difference condition includes:
[0018] The system time data is clock-calibrated according to the clock calibration data to obtain system time adjustment data;
[0019] According to the system time adjustment data and the network time data, the adjustment time difference between the system time adjustment data and the network time data is determined, and the adjustment time difference is the time difference between the calibrated system time data and the network time data;
[0020] If the adjustment time difference meets the preset time difference condition, the clock calibration data is determined as the adjustment time difference.
[0021] Further, after the system time data is clock-calibrated according to the clock calibration data to obtain system time adjustment data, the method further includes:
[0022] When the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, after a preset time value is delayed, the system time data is clock-calibrated based on the clock calibration data, and the preset time value is greater than the clock calibration data.
[0023] Further, the preset time difference threshold includes a second preset time difference sub-threshold, and the method further includes:
[0024] When the network time data represents abnormal network synchronization, a plurality of historical time differences are obtained, and the historical time difference is the time difference between the system time data and the network time data when the network time data represents normal network synchronization;
[0025] When the difference between the maximum time difference corresponding to the plurality of historical time differences and the minimum time difference corresponding to the plurality of historical time differences is less than the preset difference threshold, it is determined whether the maximum time difference corresponding to the plurality of historical time differences is less than the second preset time difference sub-threshold;
[0026] When the maximum time difference is less than the second preset time difference sub-threshold, the time difference average value of the plurality of historical time differences is determined;
[0027] Determine time calibration data according to the absolute value of the average time difference and the preset time difference threshold, where the time calibration data is used to calibrate the system time data.
[0028] Furthermore, the preset time difference threshold includes a third preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold;
[0029] Correspondingly, the determining the time calibration data according to the absolute value of the average time difference and the preset time difference threshold includes:
[0030] In the case where the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and the absolute value of the average time difference is less than the second preset average time difference sub-threshold, determine the time calibration data as the second preset clock calibration value;
[0031] In the case where the absolute value of the average time difference is less than the third preset average time difference sub-threshold, determine the time calibration data as the third preset clock calibration value, and the third preset clock calibration value is less than the second preset clock calibration value.
[0032] On the other hand, an embodiment of the present application provides a clock calibration device, and the above device includes:
[0033] A data acquisition module, configured to acquire network time data and the system time data of the target device;
[0034] A clock calibration data determination module, configured to determine clock calibration data according to the network time data and the system time data when the network time data represents normal network synchronization, where the clock calibration data is used to calibrate the system time data;
[0035] A clock calibration module, configured to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold.
[0036] On the other hand, a clock calibration device is provided, and the clock calibration device includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the clock calibration method as described above.
[0037] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the clock calibration method as described above.
[0038] Implementing the present application has the following beneficial effects:
[0039] In the embodiment of the present application, by obtaining network time data and system time data of a target device, and when the network time data represents normal network synchronization, clock calibration data is determined according to the network time data and the system time data, and the clock calibration data is used to calibrate the system time data, so as to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold. Using the technical solution provided by the present application, it is possible to avoid the occurrence of jump seconds and rollbacks in the system time data during the clock calibration process, thereby improving the clock calibration accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0041] Figure 1 It is a schematic flowchart of a clock calibration method provided by an embodiment of the present application;
[0042] Figure 2 It is a schematic flowchart of a method for determining clock calibration data provided by an embodiment of the present application;
[0043] Figure 3 It is a schematic flowchart of a specific method for determining clock calibration data provided by an embodiment of the present application;
[0044] Figure 4 It is a schematic flowchart of a method for determining clock calibration data as an adjustment time difference provided by an embodiment of the present application;
[0045] Figure 5 It is a schematic flowchart of a method for determining time calibration data provided by an embodiment of the present application;
[0046] Figure 6 It is a schematic flowchart of a specific method for determining time calibration data provided by an embodiment of the present application;
[0047] Figure 7 Structure schematic diagram of a clock calibration device provided by an embodiment of the present application;
[0048] Figure 8 Structure schematic diagram of a clock calibration data determination module provided by an embodiment of the present application;
[0049] Figure 9 Structure schematic diagram of a clock calibration data determination sub-module provided by an embodiment of the present application;
[0050] Figure 10 Structure schematic diagram of a clock calibration module provided by an embodiment of the present application;
[0051] Figure 11 Structure schematic diagram of a time calibration data determination module provided by an embodiment of the present application;
[0052] Figure 12 Structure schematic diagram of a server provided by an embodiment of the present application. Detailed implementation manners
[0053] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0054] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0055] Please refer to Figure 1 , which shows a flow schematic diagram of a clock calibration method provided by an embodiment of the present application. Next, in conjunction with Figure 1Describe the technical solution of this application in detail. It should be noted that this specification provides method operation steps as described in the embodiments or flowcharts, but based on routine or non-creative labor, there may be more or fewer operation steps. The step order listed in the embodiments is only one way among the execution orders of numerous steps and does not represent the only execution order. The method specifically includes the following steps:
[0056] S101: Obtain network time data and the system time data of the target device.
[0057] Specifically, the network time data is the time data provided by the network clock server, which can be used as the standard network time. Furthermore, the network time data and the system time data of the target device can be compared to determine the correspondence between the system time data corresponding to the target device and the network time data. Thus, when there is a time difference between the system time data corresponding to the target device and the network time data, the corresponding clock calibration method can be selected according to different time differences, thereby avoiding the occurrence of leap seconds and rollbacks in the system time data during the clock calibration process, and improving the clock calibration accuracy.
[0058] In a specific embodiment, the system time data is the system time on the target device, and there may be a large time difference from the network time data. Thus, the clock calibration method provided by this application can accurately calibrate the system time data. During the clock calibration process, it can avoid large jumps in the clock calibration, resulting in the occurrence of leap seconds and rollbacks in the system time data. Among them, the target device can be a kitchen appliance device with a reservation function. Exemplarily, the target device can be an electric pressure cooker, an automatic stir-fry pan, or a cooker, etc. Furthermore, due to the reasons of the target device itself, the system time data corresponding to the target device may have errors. When the system time data corresponding to the target device has errors, the user experience of the target device may be poor. Therefore, it is necessary to calibrate the system time data corresponding to the target device, and during the clock calibration process, it can avoid the occurrence of leap seconds and rollbacks in the system time data during the clock calibration process to improve the accuracy of the clock calibration.
[0059] It should be noted that the target device can also be other household devices. Exemplarily, the target device can also be a television with a reservation function for turning on or off, a stereo with a reservation function for turning on or off, or a sweeping robot with a reservation function for turning on or off, etc. The above can all be applied to the clock calibration method described in the embodiments of this application for clock calibration.
[0060] S102: When the network time data represents normal network synchronization, determine the clock calibration data according to the network time data and the system time data. The clock calibration data is used to calibrate the system time data.
[0061] In the embodiments of the present application, when the network time data represents normal network synchronization, it indicates that the network time data can be obtained normally. Among them, a request can be sent to the network clock server to obtain the network time data feedback by the network clock server. When the network time data cannot be obtained, the request is sent at a frequency of once per minute. If the network time data cannot be obtained continuously for 3 times, it indicates that there is a network anomaly or a server anomaly, and thus it can be determined that the current synchronization is abnormal. When the network clock server cannot be obtained, the calibration data for calibrating the system time data can also be determined. For details, refer to the technical solutions corresponding to the case where the network time data represents abnormal network synchronization below.
[0062] In a specific embodiment, when the network time data represents normal network synchronization, the clock calibration data can be determined according to the corresponding relationship between the network time data and the system time data, so as to calibrate the system time data according to the clock calibration data.
[0063] In a specific implementation manner, as Figure 2 shown, it is a schematic flowchart of a method for determining clock calibration data provided by the embodiments of the present application. Specifically, step S102 may include:
[0064] S1021: Determine the time difference between the network time data and the system time data according to the network time data and the system time data;
[0065] S1022: Determine the clock calibration data according to the absolute value of the time difference and the preset time difference threshold.
[0066] In the embodiments of the present application, the time difference is equal to the difference between the network time data and the system time data. That is to say, the time difference is equal to the network time data minus the system time data. Specifically, when the time difference is positive, it indicates that the current system time data is slower. Therefore, each time an adjustment is made, the system time data can be added with the clock calibration data to achieve clock calibration of the system time data. When the time difference is negative, it indicates that the current system time data is faster. Therefore, each time an adjustment is made, the system time data can be subtracted by the clock calibration data to achieve clock calibration of the system time data. After the time difference is determined, the clock calibration data can be determined according to the corresponding relationship between the absolute value of the time difference and the preset time difference threshold, so as to achieve clock calibration for the system time data.
[0067] In a specific embodiment, the preset time difference threshold includes a first preset time difference sub-threshold, a second preset time difference sub-threshold, and a third preset time difference sub-threshold, where the first preset time difference sub-threshold is less than the second preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold. Correspondingly, as Figure 3 shown, it is a schematic flowchart of a specific method for determining clock calibration data provided by an embodiment of the present application. Specifically, step S1022 may include:
[0068] S10221: When the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold, determine the clock calibration data as the network time data;
[0069] S10222: When the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, determine the clock calibration data as the first preset clock calibration value;
[0070] S10223: When the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, determine the clock calibration data as the second preset clock calibration value, and the second preset clock calibration value is less than the first preset clock calibration value;
[0071] S10224: When the absolute value of the time difference is less than the third preset time difference sub-threshold, determine the clock calibration data as the third preset clock calibration value, and the third preset clock calibration value is less than the second preset clock calibration value.
[0072] In the embodiment of the present application, according to the correspondence between the absolute value of the time difference and the preset time difference threshold, the clock calibration data can be determined. Specifically, when the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold, it indicates that the target device is in an abnormal situation such as being powered on for the first time or recovering after a long-term network disconnection. Then, a clock calibration strategy can be directly adopted to determine the clock calibration data as the network time data, that is, directly assign the network time data to the system time data, and then the clock calibration process of the target device can be completed.
[0073] In actual applications, the first preset time difference sub-threshold can be 500 seconds, 550 seconds, 600 seconds, etc. Preferably, the first preset time difference sub-threshold is 600 seconds.
[0074] In some embodiments, when the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, the clock calibration data can be determined as the first preset clock calibration value. Herein, the first preset clock calibration value is the preset clock calibration value corresponding to the situation where the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold. Specifically, the first preset clock calibration value is the clock calibration value for calibrating the system time data once. It can be understood that the system time data can be calibrated multiple times, and each time the calibration is performed according to the first preset clock calibration value until the time difference between the calibrated system time data and the network time data is no longer within the range where the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold. Exemplarily, the first preset clock calibration value can be 50 milliseconds, 100 milliseconds, 120 milliseconds, 150 milliseconds, etc. Preferably, the first preset clock calibration value is 100 milliseconds.
[0075] In practical applications, the second preset time difference sub-threshold can be 5 seconds, 8 seconds, 10 seconds, etc. Preferably, the second preset time difference sub-threshold is 10 seconds.
[0076] In some embodiments, when the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, the clock calibration data can be determined as the second preset clock calibration value. Herein, the second preset clock calibration value is the preset clock calibration value corresponding to the situation where the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold. Specifically, the second preset clock calibration value is the clock calibration value for calibrating the system time data once. It can be understood that the system time data can be calibrated multiple times, and each time the calibration is performed according to the second preset clock calibration value until the time difference between the calibrated system time data and the network time data is no longer within the range where the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold. Exemplarily, the second preset clock calibration value can be 20 milliseconds, 30 milliseconds, 40 milliseconds, 45 milliseconds, etc. Preferably, the second preset clock calibration value is 30 milliseconds.
[0077] In practical applications, the third preset time difference sub-threshold can be 0.5 seconds, 0.8 seconds, 1 second, etc. Preferably, the third preset time difference sub-threshold is 1 second.
[0078] Further, by setting the second preset clock calibration value to be less than the first preset clock calibration value, so that when the absolute value of the time difference is small, a relatively small preset clock calibration value can be calibrated at one time. That is, through multiple calibrations, the time difference determined after calibration can meet the time difference range to which the next time difference belongs. Furthermore, the clock calibration process of the next stage can be carried out, that is, the clock calibration process in the range where the absolute value of the time difference is less than the third preset time difference sub-threshold can be carried out, so as to avoid large jumps and changes during the clock calibration process, as well as the occurrence of leap seconds and rollbacks in the system time data, and improve the accuracy of clock calibration.
[0079] In some embodiments, when the absolute value of the time difference is less than the third preset time difference sub-threshold, the clock calibration data can be determined as the third preset clock calibration value, where the third preset clock calibration value is the preset clock calibration value corresponding to the situation where the absolute value of the time difference is less than the third preset time difference sub-threshold. Specifically, the third preset clock calibration value is the clock calibration value for calibrating the system time data once. It can be understood that the system time data can be calibrated multiple times, and each time it is calibrated according to the third preset clock calibration value until the time difference between the calibrated system time data and the network time data is no longer within the range less than the third preset time difference sub-threshold. Exemplarily, the third preset clock calibration value can be 5 milliseconds, 10 milliseconds, 15 milliseconds, 20 milliseconds, etc. Preferably, the third preset clock calibration value is 10 milliseconds.
[0080] Further, by setting the third preset clock calibration value to be less than the second preset clock calibration value, so that when the absolute value of the time difference is small, a relatively small preset clock calibration value can be calibrated at one time. That is, through multiple calibrations, the time difference determined after calibration can meet the time difference range to which the next time difference belongs. Furthermore, the clock calibration process of the next stage can be carried out, so as to avoid large jumps and changes during the clock calibration process, as well as the occurrence of leap seconds and rollbacks in the system time data, and improve the accuracy of clock calibration.
[0081] S103: Perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets the preset time difference condition, and the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than the preset time difference threshold.
[0082] In the embodiments of the present application, the process of calibrating the system time data according to the clock calibration data is to increase the system time data by one or more corresponding clock calibration data, or to decrease the system time data by one or more corresponding clock calibration data, until the time difference between the calibrated system time data and the network time data meets the preset time difference condition, where the preset time difference condition is that the time difference is less than the preset time difference threshold. Exemplarily, the preset time difference threshold is equal to the third preset clock calibration value. Specifically, the preset time difference threshold is 10 milliseconds. Further, when the time difference is less than the preset time difference threshold, the clock calibration data can be determined as the time difference less than the preset time difference threshold. That is to say, the system time data can be increased by a time difference less than the preset time difference threshold, thus realizing the complete clock calibration process at the present stage.
[0083] In an alternative embodiment, as Figure 4 shown, it is a schematic flowchart of a method for determining the clock calibration data as the adjustment time difference provided by the embodiments of the present application. Specifically, step S103 may include:
[0084] S1031: Calibrate the system time data according to the clock calibration data to obtain the system time adjustment data;
[0085] S1032: Determine the adjustment time difference between the system time adjustment data and the network time data according to the system time adjustment data and the network time data. The adjustment time difference is the time difference between the calibrated system time data and the network time data;
[0086] S1033: If the adjustment time difference meets the preset time difference condition, determine the clock calibration data as the adjustment time difference.
[0087] In the embodiments of the present application, the system time adjustment data is equal to the system time data plus the clock calibration data, or the system time adjustment data is equal to the system time data minus the clock calibration data, which mainly depends on whether the current time difference is positive or negative. Specifically, when the time difference is positive, it indicates that the current system time data is slow, and thus the system time adjustment data is equal to the system time data plus the clock calibration data. When the time difference is negative, it indicates that the current system time data is fast, and thus the system time adjustment data is equal to the system time data minus the clock calibration data.
[0088] Further, after step S1031, the method further includes:
[0089] S10311: When the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, after delaying a preset time value, the system time data is clock-calibrated based on the clock calibration data, and the preset time value is greater than the clock calibration data.
[0090] Specifically, when the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, it indicates that there are abnormal conditions such as second jumps and rollbacks when adjusting according to the current system time adjustment data. Therefore, after delaying a preset time value greater than the clock calibration data in the current stage, the system time data is clock-calibrated based on this clock calibration data. At this time, since the delay is greater than the preset time value of the clock calibration data in the current stage, it is possible to skip the situation where there may be second jumps or rollbacks and enter the next stage. Therefore, after delaying a preset time value greater than the clock calibration data in the current stage, the situation of second jumps or rollbacks can be avoided.
[0091] In actual applications, the preset time value can be 200 milliseconds, 100 milliseconds, 50 milliseconds, etc. Specifically, in the stage where the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, after delaying 200 milliseconds, clock calibration is performed according to the first preset clock calibration value. In the stage where the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, after delaying 100 milliseconds, clock calibration is performed according to the second preset clock calibration value. In the stage where the absolute value of the time difference is less than the third preset time difference sub-threshold, after delaying 50 milliseconds, clock calibration is performed according to the third preset clock calibration value.
[0092] In some embodiments, regardless of whether the preset time value is delayed, after determining the system time adjustment data, it is necessary to determine the adjustment time difference between the system time adjustment data and the network time data according to the system time adjustment data and the network time data. Among them, the adjustment time difference is the time difference between the calibrated system time data and the network time data, so as to facilitate judging whether the determined adjustment time difference falls within the range corresponding to the current time difference. When the determined adjustment time difference falls within the range corresponding to the current time difference, continue to adjust according to the clock calibration data determined by the range corresponding to the current time difference until the determined adjustment time difference does not fall within the range corresponding to the current time difference, and then it will fall within the range corresponding to the next time difference.
[0093] It should be noted that the range value corresponding to the next time difference is smaller than the range corresponding to the current time difference. Exemplarily, when the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, after determining the clock calibration data as the first preset clock calibration value, calibration is performed according to the first preset clock calibration value until the adjustment time difference between the calibrated system time data and the network time data falls within the range greater than or equal to the third preset time difference sub-threshold and the absolute value of the time difference is less than the second preset time difference sub-threshold. When the adjustment time difference falls within the range greater than or equal to the third preset time difference sub-threshold and the absolute value of the time difference is less than the second preset time difference sub-threshold, calibration will be performed according to the second preset clock calibration value until the adjustment time difference between the calibrated system time data and the network time data falls within the range less than the third preset time difference sub-threshold. When the adjustment time difference falls within the range less than the third preset time difference sub-threshold, calibration will be performed according to the third preset clock calibration value until the adjustment time difference meets the preset time difference condition, and the clock calibration data is determined as the adjustment time difference, ending the clock calibration.
[0094] That is to say, in the entire clock calibration process in the embodiment of the present application, clock calibration is performed in a progressive and step-by-step manner in stages. Specifically, the stages are: the stage where the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold, the stage where the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, the stage where the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, and the stage where the absolute value of the time difference is less than the third preset time difference sub-threshold. The progressive and step-by-step manner is to perform different clock calibrations in different stages and verify the values after clock calibration so as to perform fine-tuning in the next stage when the next stage is satisfied. Among them, the fine-tuning is reflected in that the value corresponding to each time difference decreases, and the clock calibration value also decreases, thereby avoiding the situation of second jump or rollback.
[0095] In an alternative embodiment, the preset time difference threshold includes the second preset time difference sub-threshold. Correspondingly, as Figure 5 shown, it is a schematic flowchart of a method for determining time calibration data provided by an embodiment of the present application. Specifically, the method further includes:
[0096] S104: In the case where the network time data represents abnormal network synchronization, obtain multiple historical time differences, where the historical time difference is the time difference between the system time data and the network time data when the network time data represents normal network synchronization;
[0097] S105: When the difference between the maximum time difference corresponding to multiple historical time differences and the minimum time difference corresponding to multiple historical time differences is less than a preset difference threshold, determine whether the maximum time difference corresponding to multiple historical time differences is less than a second preset time difference sub-threshold;
[0098] S106: When the maximum time difference is less than the second preset time difference sub-threshold, determine the average time difference of multiple historical time differences;
[0099] S107: Determine time calibration data according to the absolute value of the average time difference and the preset time difference threshold, and the time calibration data is used to calibrate the system time data.
[0100] Specifically, when the network time data represents normal network synchronization, each time the system time data is clock-calibrated, the determined time difference is often recorded. Among them, the recorded time difference is the time difference between the system time data and the network time data or the adjusted time difference between the calibrated system time data and the network time data. Specifically, the number of recorded time differences can be 20. When the upper limit is reached, the newly recorded time difference replaces the earliest recorded time difference for cyclic update. Then, in the case where the network time data represents abnormal network synchronization, multiple historical time differences can be obtained. Specifically, multiple historical time differences can be 20, 15, 10, or 5. Preferably, multiple historical time differences are 10 historical time differences.
[0101] In some embodiments, when the difference between the maximum time difference corresponding to multiple historical time differences and the minimum time difference corresponding to multiple historical time differences is less than the preset difference threshold, it indicates that the difference between the network time data and the system time data is small. Then, it can be determined whether the maximum time difference corresponding to multiple historical time differences is less than the second preset time difference sub-threshold. If the maximum time difference is less than the second preset time difference sub-threshold, it indicates that the clock calibration can be performed in this way. Then, the average time difference of multiple historical time differences can be determined, so as to determine the time calibration data for calibrating the system time data according to the absolute value of the average time difference and the preset time difference threshold, so as to realize the clock calibration process in the case where the network time data represents abnormal network synchronization.
[0102] It should be noted that when the difference between the maximum time difference corresponding to multiple historical time differences and the minimum time difference corresponding to multiple historical time differences is greater than or equal to the preset difference threshold, and the maximum time difference corresponding to multiple historical time differences is greater than or equal to the second preset time difference sub-threshold, the clock calibration is directly ended to avoid clock calibration errors, and then the clock calibration accuracy can be improved.
[0103] In practical applications, the preset difference threshold can be 4 seconds, 3 seconds, 2 seconds, etc. Preferably, the preset difference threshold is 2 seconds, and the average time difference is the arithmetic average of 10 historical time differences.
[0104] In an alternative embodiment, the preset time difference threshold includes a third preset time difference sub-threshold, where the second preset time difference sub-threshold is less than the third preset time difference sub-threshold. Correspondingly, as Figure 6 shown, it is a schematic flowchart of a specific method for determining time calibration data provided by an embodiment of the present application. Specifically, step S107 may include:
[0105] S1071: When the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and less than the second preset average time difference sub-threshold, determine the time calibration data as the second preset clock calibration value;
[0106] S1072: When the absolute value of the average time difference is less than the third preset average time difference sub-threshold, determine the time calibration data as the third preset clock calibration value, and the third preset clock calibration value is less than the second preset clock calibration value.
[0107] In the embodiments of the present application, since the maximum time differences corresponding to multiple historical time differences are all less than the second preset time difference sub-threshold, it can be directly determined that the average time difference is also less than the second preset time difference sub-threshold. Therefore, in the case of being less than the second preset time difference sub-threshold, clock calibration can be performed in a progressive and step-by-step manner in stages to achieve the clock calibration process in the case of abnormal network synchronization in network time data representation.
[0108] Specifically, when the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and less than the second preset average time difference sub-threshold, the time calibration data can be determined as the second preset clock calibration value. Here, the second preset clock calibration value is the preset clock calibration value corresponding to the situation where the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and less than the second preset average time difference sub-threshold. Specifically, the second preset clock calibration value is the clock calibration value for calibrating the system time data once. It can be understood that the system time data can be calibrated multiple times, and each time it is calibrated according to the second preset clock calibration value until the average time difference between the calibrated system time data and the network time data is no longer within the range where it is greater than or equal to the third preset average time difference sub-threshold and less than the second preset average time difference sub-threshold. Exemplarily, the second preset clock calibration value is 30 milliseconds, and the third preset average time difference sub-threshold is 1 second.
[0109] In some embodiments, when the absolute value of the average time difference is less than the third preset average time difference sub-threshold, the time calibration data can be determined as the third preset clock calibration value. Here, the third preset clock calibration value is the preset clock calibration value corresponding to the situation where the absolute value of the average time difference is less than the third preset average time difference sub-threshold. Specifically, the third preset clock calibration value is the clock calibration value for calibrating the system time data once. It can be understood that the system time data can be calibrated multiple times, and each time it is calibrated according to the third preset clock calibration value until the average time difference between the calibrated system time data and the network time data is no longer within the range where it is less than the third preset average time difference sub-threshold. Exemplarily, the third preset clock calibration value is 10 milliseconds.
[0110] Further, by setting the third preset clock calibration value to be less than the second preset clock calibration value, in the case where the absolute value of the average time difference is small, a preset clock calibration value with a small value can be calibrated once. That is, through multiple calibrations, the average time difference determined after calibration can be made to satisfy the average time difference range to which the next average time difference belongs, and then the clock calibration process of the next stage can be carried out, thereby avoiding large jumps and fluctuations during the clock calibration process, as well as the occurrence of second jumps and rollbacks in the system time data, and improving the accuracy of clock calibration.
[0111] In some specific embodiments, the system time data is clock calibrated according to the time calibration data until the time difference between the calibrated system time data and the network time data meets the preset time difference condition. Specifically, the system time data is clock calibrated according to the time calibration data to obtain system time adjustment data. According to the system time adjustment data and the network time data, the adjustment time difference between the system time adjustment data and the network time data is determined. If the adjustment time difference meets the preset time difference condition, the time calibration data is determined as the adjustment time difference.
[0112] In actual applications, after clock calibrating the system time data according to the time calibration data to obtain system time adjustment data, it is also necessary to determine whether the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback situation. In the case where the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, after delaying a preset time value, the system time data is clock calibrated based on the time calibration data, where the preset time value is greater than the time calibration data.
[0113] Specifically, when the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, it indicates that there are abnormal situations such as second jumps and rollbacks when adjusting according to the current system time adjustment data. Then, after delaying a preset time value greater than the clock calibration data in the current stage, the system time data is clock calibrated based on the clock calibration data. At this time, since the delay is greater than the preset time value of the clock calibration data in the current stage, it is possible to skip the situation that may have a second jump or rollback and enter the next stage. Therefore, after delaying a preset time value greater than the clock calibration data in the current stage, the situation of second jump or rollback can be avoided.
[0114] In actual applications, the preset time value can be 100 milliseconds or 50 milliseconds, etc. Specifically, in the stage where the absolute value of the time difference average is greater than or equal to the third preset time difference average sub-threshold and less than the second preset time difference average sub-threshold, after delaying 100 milliseconds, clock calibration is performed according to the second preset clock calibration value. In the stage where the absolute value of the time difference average is less than the third preset time difference average sub-threshold, after delaying 50 milliseconds, clock calibration is performed according to the third preset clock calibration value.
[0115] In some embodiments, regardless of whether a preset time value is delayed, after determining the system time adjustment data, it is necessary to determine the average adjustment time difference between the system time adjustment data and the network time data, where the average adjustment time difference is the average time difference between the calibrated system time data and the network time data, so as to facilitate determining whether the determined average adjustment time difference falls within the range corresponding to the current average time difference. When the determined average adjustment time difference falls within the range corresponding to the current average time difference, continue to adjust according to the clock calibration data determined by the range corresponding to the current average time difference until the determined average adjustment time difference does not fall within the range corresponding to the current average time difference, and then it will fall within the range corresponding to the next average time difference.
[0116] It should be noted that the range value corresponding to the next average time difference is smaller than the range corresponding to the current average time difference. Exemplarily, when the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and the absolute value of the average time difference is less than the second preset average time difference sub-threshold, after determining the time calibration data as the second preset clock calibration value, calibrate according to the second preset clock calibration value until the average adjustment time difference between the calibrated system time data and the network time data falls within the range corresponding to less than the third preset average time difference sub-threshold. When the average adjustment time difference falls within the range corresponding to less than the third preset average time difference sub-threshold, calibrate according to the third preset clock calibration value until the average adjustment time difference meets the preset average time difference condition, and determine the clock calibration data as the average adjustment time difference to end the clock calibration.
[0117] That is to say, in the entire clock calibration process of the embodiments of the present application, clock calibration is carried out in a progressive and step-by-step manner in stages. Specifically, the stages are: the stage where the absolute value of the average time difference is greater than or equal to the third preset average time difference sub-threshold and the absolute value of the average time difference is less than the second preset average time difference sub-threshold, and the stage where the absolute value of the average time difference is less than the third preset average time difference sub-threshold. The progressive and step-by-step manner is to perform different clock calibrations in different stages and verify the values after clock calibration, so as to perform fine-tuning in the next stage when the next stage is satisfied. Among them, the fine-tuning is reflected in that the value corresponding to the average time difference decreases each time, and the clock calibration value also decreases, thereby avoiding the situation of second jumping or rolling back.
[0118] As can be seen from the above technical solutions of the embodiments of the present application, the following technical effects are achieved:
[0119] In the embodiment of the present application, by obtaining network time data and the system time data of a target device, and when the network time data represents normal network synchronization, according to the network time data and the system time data, clock calibration data is determined. The clock calibration data is used to calibrate the system time data, so as to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold. By using the technical solution provided by the present application, it is possible to avoid the occurrence of leap seconds and rollbacks in the system time data during the clock calibration process, thereby improving the clock calibration accuracy.
[0120] In the embodiment of the present application, a clock calibration device is further provided, as Figure 7 shown, which is a schematic structural diagram of a clock calibration device provided by the embodiment of the present application. Specifically, the clock calibration device includes:
[0121] A data acquisition module 10, configured to acquire network time data and the system time data of a target device.
[0122] A clock calibration data determination module 20, configured to determine clock calibration data according to the network time data and the system time data when the network time data represents normal network synchronization. The clock calibration data is used to calibrate the system time data.
[0123] A clock calibration module 30, configured to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold.
[0124] Further, as Figure 8 shown, which is a schematic structural diagram of the clock calibration data determination module provided by the embodiment of the present application. Specifically, the clock calibration data determination module 20 includes:
[0125] A time difference determination sub-module 201, configured to determine the time difference between the network time data and the system time data according to the network time data and the system time data.
[0126] A clock calibration data determination sub-module 202, configured to determine the clock calibration data according to the absolute value of the time difference and a preset time difference threshold.
[0127] Further, the preset time difference threshold includes a first preset time difference sub-threshold, a second preset time difference sub-threshold, and a third preset time difference sub-threshold, where the first preset time difference sub-threshold is less than the second preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold; correspondingly, as Figure 9 shown, it is a schematic structural diagram of the clock calibration data determination sub-module provided by an embodiment of the present application. Specifically, the clock calibration data determination sub-module 202 includes:
[0128] A first determination sub-module 2021, configured to determine the clock calibration data as network time data when the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold.
[0129] A second determination sub-module 2022, configured to determine the clock calibration data as the first preset clock calibration value when the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold.
[0130] A third determination sub-module 2023, configured to determine the clock calibration data as the second preset clock calibration value when the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, and the second preset clock calibration value is less than the first preset clock calibration value.
[0131] A fourth determination sub-module 2024, configured to determine the clock calibration data as the third preset clock calibration value when the absolute value of the time difference is less than the third preset time difference sub-threshold, and the third preset clock calibration value is less than the second preset clock calibration value.
[0132] Further, as Figure 10 shown, it is a schematic structural diagram of the clock calibration module provided by an embodiment of the present application. Specifically, the clock calibration module 30 includes:
[0133] A system time adjustment data determination sub-module 301, configured to perform clock calibration on the system time data according to the clock calibration data to obtain system time adjustment data.
[0134] An adjustment time difference determination sub-module 302, configured to determine an adjustment time difference between the system time adjustment data and the network time data according to the system time adjustment data and the network time data, and the adjustment time difference is the time difference between the calibrated system time data and the network time data.
[0135] , configured to determine the clock calibration data as the adjustment time difference if the adjustment time difference meets the preset time difference condition.
[0136] Further, the device further includes:
[0137] A clock calibration determination sub-module 3011, configured to, when the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, after delaying a preset time value, perform clock calibration on the system time data based on the clock calibration data, where the preset time value is greater than the clock calibration data.
[0138] Further, the preset time difference threshold includes a second preset time difference sub-threshold. As Figure 11 shown, it is a schematic structural diagram of the time calibration data determination module provided by an embodiment of the present application. Specifically, the device further includes:
[0139] A historical time difference acquisition module 104, configured to acquire a plurality of historical time differences when the network time data represents abnormal network synchronization, where the historical time difference is the time difference between the system time data and the network time data when the network time data represents normal network synchronization.
[0140] A judgment module 105, configured to judge whether the maximum time difference corresponding to the plurality of historical time differences is less than the second preset time difference sub-threshold when the difference between the maximum time difference and the minimum time difference corresponding to the plurality of historical time differences is less than the preset difference threshold.
[0141] A time difference average value determination module 106, configured to determine the time difference average value of the plurality of historical time differences when the maximum time difference is less than the second preset time difference sub-threshold.
[0142] A time calibration data determination module 107, configured to determine the time calibration data according to the absolute value of the time difference average value and the preset time difference threshold, where the time calibration data is used to calibrate the system time data.
[0143] Further, the preset time difference threshold includes a third preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold; correspondingly, the time calibration data determination module 107 includes:
[0144] A fifth determination sub-module 1071, configured to determine the time calibration data as the second preset clock calibration value when the absolute value of the time difference average value is greater than or equal to the third preset time difference average value sub-threshold and less than the second preset time difference average value sub-threshold.
[0145] A sixth determination sub-module 1072, configured to determine the time calibration data as the third preset clock calibration value when the absolute value of the time difference average value is less than the third preset time difference average value sub-threshold, where the third preset clock calibration value is less than the second preset clock calibration value.
[0146] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0147] An embodiment of the present application provides a clock calibration device, which includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the clock calibration method provided in the above method embodiment.
[0148] The memory can be used to store software programs and modules. The processor runs the software programs and modules stored in the memory to perform various functional applications and data processing. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the device. In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0149] The clock calibration device can be a server. An embodiment of the present application also provides a schematic structural diagram of a server. Please refer to Figure 12 The server 1200 is used to implement the data processing method provided in the above embodiments. The server 1200 may vary greatly due to configuration or performance differences, and may include one or more processors 1210 (for example, one or more processors) and a memory 1230, and one or more storage media 1220 (for example, one or more mass storage devices) for storing application programs 1223 or data 1222. Among them, the memory 1230 and the storage media 1220 can be transient storage or persistent storage. The programs stored in the storage media 1220 can include one or more modules, and each module can include a series of instruction operations on the server. Further, the processor 1210 can be configured to communicate with the storage media 1220 and execute a series of instruction operations in the storage media 1220 on the server 1200. The server 1200 can also include one or more power supplies 1260, one or more wired or wireless network interfaces 1250, one or more input / output interfaces 1240, and / or one or more operating systems 1221, such as Windows ServerTM, MacOS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0150] An embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium can be disposed in a server to store at least one instruction, at least one program, a code set, or an instruction set related to a clock calibration method in a method embodiment. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the clock calibration method provided in the above method embodiment.
[0151] Optionally, in this embodiment, the above storage medium may be located in at least one of multiple network servers in a computer network. Optionally, in this embodiment, the above storage medium may include, but is not limited to: various media that can store program codes such as USB flash drives, read-only memories (ROMs), random access memories (RAMs), external hard drives, magnetic disks, or optical discs.
[0152] It should be noted that: the above sequence of embodiments of the present application is only for description and does not represent the superiority or inferiority of the embodiments. And the above specific embodiments of this specification have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be executed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0153] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system and server embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0154] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present application, and all should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A clock calibration method, characterized in that, The method includes: Obtaining network time data and system time data of a target device; When the network time data indicates normal network synchronization, determining clock calibration data according to the network time data and the system time data, where the clock calibration data is used to calibrate the system time data; Performing clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold.
2. The method according to claim 1, wherein The determining the clock calibration data according to the network time data and the system time data includes: Determining the time difference between the network time data and the system time data according to the network time data and the system time data; Determining the clock calibration data according to the absolute value of the time difference and a preset time difference threshold.
3. The method according to claim 2, wherein The preset time difference threshold includes a first preset time difference sub-threshold, a second preset time difference sub-threshold, and a third preset time difference sub-threshold, where the first preset time difference sub-threshold is less than the second preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold; Correspondingly, the determining the clock calibration data according to the absolute value of the time difference and a preset time difference threshold includes: When the absolute value of the time difference is greater than or equal to the first preset time difference sub-threshold, determining the clock calibration data as the network time data; When the absolute value of the time difference is greater than or equal to the second preset time difference sub-threshold and less than the first preset time difference sub-threshold, determining the clock calibration data as a first preset clock calibration value; When the absolute value of the time difference is greater than or equal to the third preset time difference sub-threshold and less than the second preset time difference sub-threshold, determining the clock calibration data as a second preset clock calibration value, where the second preset clock calibration value is less than the first preset clock calibration value; When the absolute value of the time difference is less than the third preset time difference sub-threshold, determining the clock calibration data as a third preset clock calibration value, where the third preset clock calibration value is less than the second preset clock calibration value.
4. The method according to claim 2, wherein The performing clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition includes: Performing clock calibration on the system time data according to the clock calibration data to obtain system time adjustment data; Determining the adjustment time difference between the system time adjustment data and the network time data according to the system time adjustment data and the network time data, where the adjustment time difference is the time difference between the calibrated system time data and the network time data; If the adjusted time difference satisfies the preset time difference condition, determine the clock calibration data as the adjusted time difference.
5. The method according to claim 4, wherein After clock-calibrating the system time data according to the clock calibration data to obtain system time adjustment data, the method further includes: When the clock calibration result corresponding to the system time adjustment data indicates a second jump or rollback, after delaying a preset time value, clock-calibrate the system time data based on the clock calibration data, where the preset time value is greater than the clock calibration data.
6. The method according to claim 1, wherein The preset time difference threshold includes a second preset time difference sub-threshold, and the method further includes: When the network time data represents abnormal network synchronization, obtain a plurality of historical time differences, where the historical time difference is the time difference between the system time data and the network time data when the network time data represents normal network synchronization; When the difference between the maximum time difference and the minimum time difference corresponding to the plurality of historical time differences is less than a preset difference threshold, determine whether the maximum time difference corresponding to the plurality of historical time differences is less than the second preset time difference sub-threshold; When the maximum time difference is less than the second preset time difference sub-threshold, determine the time difference average value of the plurality of historical time differences; According to the absolute value of the time difference average value and the preset time difference threshold, determine time calibration data, where the time calibration data is used to calibrate the system time data.
7. The method according to claim 6, characterized in that, The preset time difference threshold includes a third preset time difference sub-threshold, and the second preset time difference sub-threshold is less than the third preset time difference sub-threshold; Correspondingly, determining the time calibration data according to the absolute value of the time difference average value and the preset time difference threshold includes: When the absolute value of the time difference average value is greater than or equal to the third preset time difference average value sub-threshold and the absolute value of the time difference average value is less than the second preset time difference average value sub-threshold, determine the time calibration data as the second preset clock calibration value; When the absolute value of the time difference average value is less than the third preset time difference average value sub-threshold, determine the time calibration data as the third preset clock calibration value, where the third preset clock calibration value is less than the second preset clock calibration value.
8. A clock calibration device, characterized in that, The device includes: A data acquisition module, configured to acquire network time data and the system time data of a target device; A clock calibration data determination module, configured to determine clock calibration data according to the network time data and the system time data when the network time data represents normal network synchronization, where the clock calibration data is used to calibrate the system time data; A clock calibration module, configured to perform clock calibration on the system time data according to the clock calibration data until the time difference between the calibrated system time data and the network time data meets a preset time difference condition, where the preset time difference condition is that the time difference between the calibrated system time data and the network time data is less than a preset time difference threshold.
9. A clock calibration device, characterized in that, The clock calibration device includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the clock calibration method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, At least one instruction or at least one program is stored in the storage medium. The at least one instruction or the at least one program is loaded and executed by the processor to implement the clock calibration method according to any one of claims 1 to 7.