Time synchronization method and device, storage medium and computer program product

By detecting the authenticity of the timing data, and updating the local time information after confirming its authenticity, the problem of time synchronization device being interfered with by fraudulent signals is solved, and the accuracy and reliability of timing is improved.

CN120185751AActive Publication Date: 2025-06-20SHENZHEN XINGWEIFAN ELECTRONICS TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510283590.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-06-20
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

The existing time synchronization device may be disturbed by artificial fraud signals, resulting in errors in the received time information and affecting the accuracy of timing.

Method used

By detecting the local time information, we can determine whether the obtained time data is a fraudulent time. If not, update the local time information to ensure that it is highly accurate synchronization with the external time system.

Benefits of technology

It effectively prevents timing data abnormalities caused by malicious attacks or device failures, ensures that the basic data of timing operations is accurate, improves timing accuracy, and reduces misjudgment of fraudulent time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120185751A_ABST
    Figure CN120185751A_ABST
Patent Text Reader

Abstract

The invention discloses a time synchronization method and device, a storage medium and a computer program product, and relates to the technical field of time service, and the time synchronization method comprises the steps: detecting whether obtained time service data is fraud time according to local time information; and updating local time information according to the time service data under the condition that the time service data is not fraud time. According to the invention, fraud detection is carried out on the received time service data based on the local high-precision time information, so that the interference of fraud signals is avoided, and the time service accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of time service, and particularly to a time synchronization method, device, storage medium, and computer program product. Background Art

[0002] In time synchronization technology, satellite time service is widely used in various occasions requiring precise time synchronization due to its advantages such as high precision, global coverage, and strong stability. The time signals provided in B-code, Beidou satellite signals, and GPS (Global Positioning System) signals have become important time sources for time calibration devices.

[0003] Currently, time calibration devices mainly consist of receivers, controllers, and RTC (Real Time Clock) modules. However, the receivers may be interfered by fraud signals generated artificially. These fraud signals imitate real satellite signals, causing the receivers to receive incorrect time information. Once the controller calibrates the RTC based on this incorrect time information, it will lead to a deviation in the RTC time, thereby affecting the accuracy of time synchronization and time service. Summary of the Invention

[0004] The main purpose of this application is to provide a time synchronization method, device, storage medium, and computer program product, aiming to solve the technical problem of how to improve the accuracy of time service.

[0005] To achieve the above purpose, this application proposes a time synchronization method, and the method includes:

[0006] According to the local time information, detect whether the obtained time service data is fraud time;

[0007] In the case where the time service data is not fraud time, update the local time information according to the time service data.

[0008] In one embodiment, the local time information includes local timekeeping data, and the step of detecting whether the obtained time service data is fraud time according to the local time information includes:

[0009] According to the time service data and the local timekeeping data, determine the local timekeeping deviation, and compare the local timekeeping deviation with a preset timekeeping error threshold;

[0010] In the case where the local timekeeping deviation is less than the timekeeping error threshold, determine that the time service data is not fraud time.

[0011] In one embodiment, before the step of determining the magnitude relationship between the local timekeeping deviation and the preset timekeeping error threshold, it further includes:

[0012] Determine the time interval according to the time service timestamp and the local timekeeping data;

[0013] Determine the timekeeping error threshold according to the time interval and the preset local timekeeping error.

[0014] In one embodiment, before the step of detecting whether the acquired time service data is fraudulent time according to the local time information, it further includes:

[0015] Judge whether the local end is in the power-on state according to the power-on flag bit of the local end;

[0016] In the case that the local end is in the power-on state, perform local time synchronization to obtain the synchronized local time information, and according to the synchronized local time information, execute the step of detecting whether the acquired time service data is fraudulent time;

[0017] In the case that the local end is not in the power-on state, execute the step of detecting whether the acquired time service data is fraudulent time according to the local time information.

[0018] In one embodiment, before the step of detecting whether the acquired time service data is fraudulent time according to the local time information, it further includes:

[0019] Judge whether the local end is in the oscillation-stop state according to the local clock oscillation-stop flag bit of the local end;

[0020] In the case that the local end is in the oscillation-stop state, perform local time synchronization to obtain the synchronized local time information, and according to the synchronized local time information, execute the step of detecting whether the acquired time service data is fraudulent time;

[0021] In the case that the local end is not in the oscillation-stop state, execute the step of detecting whether the acquired time service data is fraudulent time according to the local time information.

[0022] In one embodiment, the step of performing local time synchronization includes:

[0023] Connect to the standard clock source through the preset time synchronization interface;

[0024] Obtain the standard time from the standard clock source, and synchronize the local time information according to the standard time.

[0025] In one embodiment, before the step of detecting whether the acquired time service data is fraudulent time according to the local time information, it further includes:

[0026] Decode the received external time signal to obtain the time service data.

[0027] In addition, to achieve the above object, the present application further provides a time synchronization device, which includes:

[0028] A detection module, configured to detect whether the acquired time service data is fraudulent time according to local time information;

[0029] An update module, configured to update the local time information according to the time service data when the time service data is not fraudulent time.

[0030] In addition, to achieve the above object, the present application further provides a time synchronization device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the time synchronization method as described above.

[0031] In addition, to achieve the above object, the present application further provides a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, it implements the steps of the time synchronization method as described above.

[0032] In addition, to achieve the above object, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the time synchronization method as described above.

[0033] One or more technical solutions proposed by the present application have at least the following technical effects: First, according to local time information, it is detected whether the acquired time service data is fraudulent time, effectively preventing abnormal time service data that may be caused by malicious attacks or equipment failures, ensuring the accuracy of the basic data for subsequent time service operations, and improving the accuracy of time service; furthermore, when the time service data is not fraudulent time, the local time information is updated according to the time service data to correct possible deviations of the local time in real time and ensure high-precision synchronization between the local time and the external time service system; at the same time, the real-time calibration of the local time information is beneficial to reducing the misjudgment of subsequent fraudulent time and further improving the accuracy of time service. In summary, by first judging the authenticity of the time service data and then updating the local time information based on the real data, the present application not only effectively resists the interference of fraudulent time data, improves the accuracy of time service, but also ensures the high precision and reliability of the local time information. Description of the Drawings

[0034] The drawings here are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0035] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0036] Figure 1 It is a schematic flowchart provided for the first embodiment of the time synchronization method of the present application;

[0037] Figure 2 It is the overall flowchart of timing synchronization provided for the first embodiment of the present application;

[0038] Figure 3 It is the overall framework schematic diagram of the time synchronization device provided for the third embodiment of the present application;

[0039] Figure 4 It is the module structure schematic diagram of the time synchronization device in the embodiment of the present application;

[0040] Figure 5 It is the device structure schematic diagram of the hardware operating environment involved in the time synchronization method in the embodiment of the present application. Specific Embodiments

[0041] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0042] To better understand the technical solutions of the present application, the following will be described in detail in conjunction with the accompanying drawings of the specification and specific embodiments.

[0043] In this embodiment, for the convenience of description, the time synchronization system is used as the execution subject for elaboration below.

[0044] To avoid the interference of fraud signals and ensure the reliability of the time synchronization device, most conventional technologies rely on complex hardware devices or encryption authentication mechanisms, or adopt cross-verification technologies of multi-source signals, etc. to achieve anti-interference. However, these methods will not only increase the timing cost but may also have poor effects in specific environments and fail to fully cover all interference scenarios.

[0045] The present application provides a solution. According to local time information, it detects whether the obtained time service data is fraudulent time, effectively identifying those fraudulent time information that disguises as normal time service signals, and avoiding using inaccurate time data for subsequent local time synchronization. Furthermore, in the case where the time service data is not fraudulent time, the local time information is updated according to the time service data. On the one hand, it ensures the high-precision synchronization of the local time with the external time service system, guaranteeing the real-time and accuracy of the local time. On the other hand, by updating the time service timestamp, it avoids the multiple accumulations of timekeeping errors, further improving the time synchronization and reliability of the system. In summary, the solution of the present application can achieve fraud detection only by using local high-precision time information (local timekeeping data and time service timestamp), without additional hardware or software costs, and has wide applicability and anti-interference ability.

[0046] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program running functions, such as a tablet computer, a personal computer, a mobile phone, a time synchronization device, etc., or an electronic device capable of implementing the above functions. Hereinafter, taking the time synchronization device as the execution subject as an example, this embodiment and the following embodiments will be described.

[0047] It should be noted that the time synchronization device usually includes hardware components such as a clock chip, can receive external time signals, and adjust its own RTC chip to be consistent with the external standard time. The clock chip can be an independent real-time clock chip or a clock module integrated in the system chip, and performs local time synchronization by receiving external time service (such as B code, Beidou signal, GPS signal).

[0048] Based on this, the embodiment of the present application provides a time synchronization method, referring to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the time synchronization method of the present application.

[0049] In this embodiment, the time synchronization method includes steps S10 to S20:

[0050] Step S10, according to local time information, detect whether the obtained time service data is fraudulent time;

[0051] It should be noted that the local time information is high-precision time information maintained by the internal storage of the device, including local timekeeping data, timing timestamps, etc. The storage media include, but are not limited to: registers inside the device, non-volatile memories, and external storage devices, etc. The local timekeeping data refers to the high-precision time information maintained inside the device, usually generated by the built-in clock module of the device (such as the RTC module), which is used to provide a time reference for the device. The local time can be synchronized with the standard time by periodically updating this value; the timing timestamp refers to the time point when the local timekeeping data was last synchronized, which is used to record the moment when the local clock is synchronized with the external timing system. The timestamp can be an integer-type Unix timestamp or in calendar time format. This embodiment does not make specific limitations on this.

[0052] In addition, it should be noted that the timing data refers to the standard time information extracted from the received external time signal, which is used to calibrate the local timekeeping data to ensure the consistency between the local time and the external time source; the fraudulent time refers to the incorrect or maliciously tampered time information. Its appearance may be due to a malfunction of the external time source itself sending incorrect time data, or the timing data being maliciously intercepted and tampered with during the transmission process.

[0053] Exemplarily, the local timekeeping data and the timing timestamp are respectively read from the time register and the timing timestamp register, and the time interval between the two is calculated; furthermore, by comparing this time interval with a preset timing interval threshold, it is determined whether the currently obtained timing data is fraudulent time; if the time interval is not within the threshold range, too long or too short time interval indicates that the timing data may be intercepted and tampered with, and the obtained timing data is determined as fraudulent time, and an interrupt signal is output to remind the staff to handle it. Among them, the timing interval threshold can be set manually or dynamically set according to historical timing rules.

[0054] It can be understood that by determining whether the obtained timing data is fraudulent time, satellite signal fraud behavior is effectively prevented, the authenticity and reliability of the timing data are ensured, and the timing accuracy is improved.

[0055] In a feasible implementation manner, before step S10, it further includes:

[0056] Step E01, decoding the received external time signal to obtain the timing data.

[0057] It should be noted that the external time signal refers to the time synchronization signal received from an external timing system (such as GPS, Beidou, B-code generator), which usually contains high-precision time information and is used to calibrate the local clock.

[0058] It should be noted that for different external time signals, such as B-code, GPS signals, and network time, there are differences in their decoding processes.

[0059] Exemplarily, for a signal in B-code format, the time information contained in the time frame is determined by detecting the high-level width of the code element, and then the timing data used to calibrate the local time is obtained; for satellite signals such as Beidou or GPS, the standard time information (timing data) used to calibrate the local time is determined by means of signal acquisition, demodulation of navigation messages, data parsing, etc.; in addition, for external time sources such as NTP (Network Time Protocol) or PTP (Precision Time Protocol), the timing data can be obtained by receiving the response information corresponding to the NTP or PTP server and parsing the returned timestamp.

[0060] Exemplarily, after the time synchronization device decodes the satellite signal to obtain the time information, it can adjust the time information according to the time difference caused by the signal propagation delay to determine the final timing data, thereby eliminating the influence of the time difference caused by the propagation delay and improving the timing accuracy. Among them, the time information is generated according to the atomic clock on the satellite, and the determination methods of the time difference include pseudorange differential method, time difference positioning method, etc.

[0061] In this embodiment, by decoding the external time signal to determine the timing data, the accuracy of the local clock can be ensured to be consistent with the external high-precision time.

[0062] Step S20, in the case where the timing data is not fraudulent time, update the local time information according to the timing data.

[0063] Exemplarily, after determining that the timing data is not fraudulent time, the local time information is calibrated. For example, the timing data is determined as the new local holdover data, and the updated moment is determined as the timing timestamp.

[0064] Exemplarily, considering the influence of the time difference from receiving the external time signal to completing the fraud detection, the local time when the external time signal is received can also be determined as the local holdover data, and the timing starts at the same time; after determining that the timing data is not fraudulent time, the local time information is updated according to the timing data and the timing time, and the time error caused by decoding and fraud detection is further eliminated through timing, improving the timing accuracy.

[0065] Exemplarily, since the above fraud detection process relies entirely on local time, a clock drift compensation algorithm can be further combined to adjust the local time, avoiding excessive local time offset and misidentifying normal time synchronization information as fraud time. Specifically, by monitoring and modeling the long-term frequency changes of local timekeeping data, the clock drift trend is predicted, and during the interval between updates of time synchronization data, the local time is automatically fine-tuned. For example, for the inherent instability of the hardware clock (such as frequency fluctuations caused by temperature and voltage changes), the Kalman filter clock drift compensation algorithm can be used to continuously adjust the local time between two updates of time synchronization data to keep it on a high-precision time benchmark.

[0066] It can be understood that updating the local time information according to the time synchronization data ensures the consistency between the local time and the external time synchronization data; meanwhile, the determination of non-fraudulent time synchronization data prevents the impact of malicious or incorrect time data on the system and improves the accuracy of time synchronization.

[0067] In a feasible implementation manner, after step S10, it further includes:

[0068] Step E20, when the time synchronization data is fraud time, output an alarm message.

[0069] Exemplarily, when fraud time is detected, terminate the time synchronization and output an alarm message to remind the management staff to check and verify.

[0070] Exemplarily, please refer to Figure 2 , Figure 2 A general flowchart of time synchronization is provided. Specifically: S101, receive an external time signal, which contains high-precision standard time information; S102, decode the external time signal. During the decoding process, convert the standard time information into the standard format of the current device, and at the same time adapt the standard time information to the local device (remove the propagation delay error) to obtain the time synchronization data; S103, perform fraud detection on the time synchronization data according to the local timekeeping time and the time synchronization timestamp; S104, determine whether the time synchronization data is fraud time; S105, when the time synchronization data is not fraud time, update the local timekeeping data and the time synchronization timestamp (local time information) according to the time synchronization data; S106, when the time synchronization data is fraud time, output an alarm message, such as sending an alarm interrupt signal for the management staff to view.

[0071] This embodiment provides a time synchronization method. By verifying whether the time synchronization data is fraudulent time, it can effectively prevent the impact of malicious time data on the system and ensure the accuracy of time synchronization. Furthermore, by updating the local time information according to the time synchronization data, the deviation of the local clock can be calibrated, thereby improving the accuracy of time synchronization. Therefore, this embodiment can achieve fraud detection by using the high-precision clock data locally, without additional hardware or software costs, and has wide applicability and anti-interference ability.

[0072] Based on the first embodiment of this application, in the second embodiment of this application, the same or similar content as the above-mentioned embodiment 1 can be referred to the above introduction and will not be repeated hereinafter. On this basis, the local time information includes local timekeeping data, and step S10 may include steps S11 to S13:

[0073] Step S11, determine the local running time deviation according to the time synchronization data and the local timekeeping data;

[0074] Step S12, compare the size relationship between the local running time deviation and the preset running time error threshold;

[0075] It should be noted that the local running time deviation refers to the deviation between the external standard time (time synchronization data) and the local time, and can be determined according to the difference between the time synchronization data and the local timekeeping data. The running time error threshold refers to the maximum deviation allowed between the local time and the standard time in the current system, which is used for subsequent fraud detection. In the case where the local end has a high-precision timekeeping function, that is, the local time information is accurate, it is possible to determine whether the time synchronization data is fraudulent time by comparing the local running time deviation with the running time error threshold.

[0076] Exemplarily, a fixed running time error threshold can be determined according to manual setting; or the running time error threshold can be automatically determined according to the historical running time error and automatically adjusted according to the current time of time synchronization.

[0077] In a feasible implementation manner, the local time information includes a time synchronization timestamp. Before step S12, it further includes:

[0078] Step S110, determine the time synchronization interval according to the time synchronization timestamp and the local timekeeping data;

[0079] Step S111, determine the running time error threshold according to the time synchronization interval and the preset local running time error.

[0080] It should be noted that the local timekeeping error refers to the time deviation between the local clock and the ideal clock or an external precise time source, with the unit of ppm (parts per million). It quantifies how many seconds the local real-time clock may be fast or slow per million seconds. This time deviation usually changes with time and environmental conditions and is stored in the local timekeeping error register of the device. Although the local timekeeping error is affected by factors such as temperature and aging, the local real-time clock can achieve high-precision timekeeping through methods such as temperature compensation. Therefore, the local timekeeping error represents the maximum time deviation within the allowed operating conditions, such as within a temperature range.

[0081] Exemplarily, the time interval between two time synchronizations can be determined based on the local timekeeping data and the time stamp of the time synchronization in the local time information; and then, based on the time interval between two time synchronizations and the local timekeeping error, the timekeeping error threshold can be determined. The specific calculation method of the timekeeping error threshold can refer to the following formula:

[0082] Terr = [(T1 - T2) * err] / 1000000

[0083] Where Terr is the timekeeping error threshold, T1 is the local timekeeping data, T2 is the time stamp of the time synchronization, and err is the local timekeeping error. The units of Terr, T1, and T2 are all μs (microseconds); for example, in the case of err = 5 ppm, it means that the local clock is 5 seconds faster or slower than the ideal clock per million seconds, and (T1 - T2) represents the time interval between the current moment and the previous time synchronization. Then, [(T1 - T2) * err] can represent the time deviation caused by error accumulation of the local clock during this time interval. Then, by dividing by the proportional unit, the time deviation is converted from ppm unit to the actual microsecond number and determined as the timekeeping error threshold.

[0084] In this embodiment, by dynamically determining the timekeeping error threshold to adapt to different time synchronization opportunities; and determining the timekeeping error threshold completely based on the local time, avoiding being affected by the time stamp of the time synchronization data, so that fraudulent time can be accurately identified, avoiding being interfered by fraudulent signals, and improving the accuracy of time synchronization.

[0085] Step S13, when the local timekeeping deviation is less than the timekeeping error threshold, it is determined that the time synchronization data is not fraudulent time.

[0086] Exemplarily, the absolute value of the difference between the timing data T3 and the local timekeeping data T1 is determined as the local timekeeping deviation, which indicates the deviation between the external standard time and the local time; then, by comparing the local timekeeping deviation with the timing error threshold, it is determined whether the received timing data is within the normal range; if the local timekeeping deviation is less than the timing error threshold, i.e., |T3 - T1| < Terr, it indicates that the currently received timing data is the standard time within the normal range, and it can be determined that the timing data is not fraudulent time, and subsequent local time updates are performed to complete time synchronization; if the local timekeeping deviation exceeds the timing error threshold, it indicates that the current timing data is fraudulent time, and an alarm interruption signal is issued to prompt the staff to check and process it.

[0087] In this embodiment, by verifying whether the local timekeeping deviation is within the allowable range, the influence of fraudulent time on the system can be effectively prevented; when the local timekeeping deviation is less than the threshold, the timing data is considered credible, thereby ensuring the accuracy of time synchronization.

[0088] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar content as in the above-mentioned first embodiment and the second embodiment can be referred to the above introduction and will not be repeated hereinafter. On this basis, step S10 includes steps A01 to A03:

[0089] Step A01, according to the power-on flag bit of the local end, determine whether the local end is in the power-on state;

[0090] It should be noted that the power-on flag bit (Power-On Flag, POF) refers to a specific value in a binary bit or register. By checking the value of this flag bit, it can be quickly determined whether the current device has just been powered on. For example, according to the device hardware settings, if the POF is 1, it means that the device has just been powered on or reset; if the POF is 0, it means that the device has completed initialization and is not just powered on. Therefore, the device being in the power-on state indicates that the current device has just been powered on or reset, and its local time is not credible.

[0091] Step A02, in the case where the local end is in the power-on state, perform local time synchronization to obtain the synchronized local time information, and according to the synchronized local time information, execute the step of detecting whether the obtained timing data is fraudulent time;

[0092] Since the subsequent anti-fraud detection of the timing data is based on the local time information (local timekeeping data and timing timestamp), therefore, before timing, if the device is in the power-on state, that is, the device has just been powered on again, it is necessary to first synchronize the local time information to ensure that it is true and credible.

[0093] Exemplarily, a reliable external time source, such as a cesium / rubidium atomic clock, an oven-controlled crystal oscillator, a disciplined oscillator, etc., is docked through a preset hardware interface, and the standard time is directly obtained from the external time source to synchronize the local time information, ensuring that the local time information used for subsequent fraud detection is accurate and credible. Among them, the hardware interface needs to be configured according to the output format of the time source. For example, for serial data, serial port parameters (such as baud rate, data bits, stop bits, etc.) need to be configured; for PPS signals (Pulse Per Second), GPIO pins (General Purpose Input / Output) need to be configured as inputs, and an external interrupt is enabled to capture the pulse signal. By configuring the hardware interface according to the output format of the time source, it can be ensured that the signals of the time source can be correctly received and processed.

[0094] Step A03, in the case where the local end is not in the power-on state, execute the step of detecting whether the obtained time service data is fraud time according to the local time information.

[0095] It can be understood that the local end not being in the power-on state means that the current device has completed initialization, and the local time of the current device is accurate and reliable. Therefore, in the case where the local end is not in the power-on state, fraud detection can be directly performed according to the local time information.

[0096] In this embodiment, by judging the power-on state of the time synchronization device, local time synchronization is performed on the device that has just been powered on to ensure that its local time is accurate and credible, avoiding difficulties in accurately identifying fraud time and receiving time service from external high-precision time signals due to incorrect local time information.

[0097] In a feasible implementation manner, step S10 includes steps B01 to B03:

[0098] Step B01, judge whether the local end is in the stopped oscillation state according to the local clock stopped oscillation flag bit of the local end;

[0099] It should be noted that the local clock stopped oscillation flag bit is used to indicate whether the clock oscillator stops working, including CSF (Clock Stop Flag) or XSTP (eXtended Stop Flag), etc. By reading this flag bit, it can be judged whether the clock stops oscillating. For example, if the stopped oscillation flag bit is 1, it means the clock stops oscillating and the current device is in the stopped oscillation state. The stopped oscillation state refers to the state where the oscillator in the device stops oscillating or cannot generate a stable frequency signal. A device in the stopped oscillation state cannot work properly or generate accurate time information.

[0100] Step B02: When the local end is in the oscillation stop state, perform local time synchronization to obtain the synchronized local time information, and based on the synchronized local time information, detect whether the acquired time synchronization data is fraudulent time;

[0101] Exemplarily, when it is detected that the device is in the oscillation stop state, obtain the network time signal from the standby NTP server, and calculate the offset between the local clock inside the device and the NTP server time; then, based on the calculated time offset, adjust the local clock to obtain the synchronized local time information; and then, based on the synchronized local time information, perform fraud detection on the time synchronization data.

[0102] Step B03: When the local end is not in the oscillation stop state, execute the step of detecting whether the acquired time synchronization data is fraudulent time according to the local time information.

[0103] It can be understood that when the local end is not in the oscillation stop state, it means that the local clock inside the current device is working normally, and fraud detection can be directly performed on the time synchronization data according to the current local time information.

[0104] In this embodiment, by determining whether the local end is in the clock oscillation stop state and performing local time synchronization on the device in the oscillation stop state, it is ensured that its local time is accurate and reliable, avoiding the failure of fraud time recognition due to incorrect local time information, so as to ensure that the device performs time synchronization according to accurate time synchronization data and improve the accuracy of time synchronization.

[0105] In a feasible embodiment, the steps of performing local time synchronization in step A02 and / or step B02 include:

[0106] Step S03: Connect to the standard clock source through a preset time synchronization interface;

[0107] It should be noted that the time synchronization interface is a software or hardware interface for time information exchange between systems or devices, including IIC (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), etc. This interface defines the format of time data, transmission protocol, synchronization mechanism, etc., to ensure that the time between different systems or devices is consistent. The standard time source refers to a device or system that can provide high-precision time information, such as crystal oscillators, atomic clocks, etc.

[0108] Step S04: Obtain the standard time from the standard clock source and synchronize the local time information according to the standard time.

[0109] Exemplarily, assume that the time synchronization device is connected to an external RTC module (standard time source) through an SPI interface, initialize the SPI interface according to a preset instruction, configure the clock frequency, transmission protocol, synchronization mechanism, etc.; furthermore, obtain a high-precision time signal (standard time) from the RTC module through the SCK clock line (Serial Clock) and data line of the SPI, and synchronize the local time information according to the time signal, update the local timekeeping data and the timing timestamp.

[0110] In this embodiment, by connecting to the standard time source through a preset time synchronization interface, a high-precision time signal can be obtained, ensuring the accuracy of timing, and further ensuring that the local time information is accurate and reliable, which is beneficial to accurately identifying fraudulent time subsequently.

[0111] Exemplarily, to help understand the implementation process of the time synchronization method obtained by combining this embodiment with the above Embodiment 1, please refer to Figure 3 , Figure 3 A schematic diagram of the overall framework of a time synchronization device is provided. Specifically:

[0112] Before performing fraud detection, first read the power-on flag bit and / or the local clock oscillation stop flag bit of the current device from the status register. In the case where the device has just resumed power-on or the local clock is in the oscillation stop state, local time synchronization is required. For example, the external standard time source can be docked through the IIC / SPI interface, and the standard time can be obtained to update the local timekeeping data in the time register, and at the same time update the timing timestamp in the timing timestamp register according to the current moment.

[0113] Then, receive the external time signal and decode it to obtain the timing data T3.

[0114] Next, obtain the local timekeeping data T1 from the time register and the timing timestamp T2 from the timing timestamp register respectively, and perform fraud detection on the timing data T3 according to the local timekeeping data T1 and the timing timestamp T2 to determine whether it is fraudulent time.

[0115] Finally, if the timing data T3 is not fraudulent time, then update the local timekeeping data in the time register and the timing timestamp in the timing timestamp register according to the timing data T3; if the timing data T3 is fraudulent time, then generate an interrupt output, output an alarm message, and prompt the staff to handle it.

[0116] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the time synchronization method of this application. Based on this technical concept, more forms of simple transformations are within the protection scope of this application.

[0117] The embodiment of the present application further provides a time synchronization device. Please refer to Figure 4 , the time synchronization device includes:

[0118] A detection module 10, configured to detect whether the acquired time service data is fraudulent time according to the local time information;

[0119] An update module 20, configured to update the local time information according to the time service data in the case where the time service data is not fraudulent time.

[0120] The time synchronization device provided by the embodiment of the present application adopts the time synchronization method in the above embodiment, and can solve the technical problem of how to improve the accuracy of time service. Compared with the prior art, the beneficial effects of the time synchronization device provided by the present application are the same as those of the time synchronization method provided by the above embodiment, and other technical features in the time synchronization device are the same as those disclosed in the method of the above embodiment, and will not be elaborated herein.

[0121] The embodiment of the present application provides a time synchronization device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the time synchronization method in the first embodiment above.

[0122] Next, refer to Figure 5 , which shows a schematic structural diagram of a time synchronization device suitable for implementing the embodiment of the present application. The time synchronization device in the embodiment of the present application may include, but is not limited to, hardware components such as a clock chip, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The shown time synchronization device is only an example, and should not bring any limitation to the functions and usage scope of the embodiment of the present application.

[0123] As Figure 5As shown in the figure, the time synchronization device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which may perform various appropriate actions and processes according to the program stored in the read-only memory 1002 or the program loaded from the storage device 1003 into the random access memory 1004. In the random access memory 1004, various programs and data required for the operation of the time synchronization device are also stored. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other through a bus 1005. The input / output interface 1006 is also connected to the bus. Generally, the following systems may be connected to the input / output interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the time synchronization device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows a time synchronization device with various systems, it should be understood that it is not required to implement or have all the shown systems. Instead, more or fewer systems may be implemented or had.

[0124] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from the network through the communication device, or installed from the storage device 1003, or installed from the read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of the embodiments disclosed in the present application are executed.

[0125] The time synchronization device provided by the embodiments of the present application adopts the time synchronization method in the above embodiments and can solve the technical problem of how to improve the accuracy of time service. Compared with the prior art, the beneficial effects of the time synchronization device provided by the present application are the same as those of the time synchronization method provided by the above embodiments, and other technical features in the time synchronization device are the same as the features disclosed in the method of the previous embodiment, and will not be elaborated here.

[0126] It should be understood that each part disclosed in the present application may be implemented by hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in a suitable manner in any one or more embodiments or examples.

[0127] As described above, it is only the specific implementation manner of this application. However, the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims described above.

[0128] An embodiment of this application provides a computer-readable storage medium, having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the time synchronization method in the above embodiment.

[0129] The computer-readable storage medium provided by an embodiment of this application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or combined with an instruction execution system or device. The program code contained on the computer-readable storage medium can be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0130] The above computer-readable storage medium can be included in the time synchronization device; it can also exist separately without being assembled into the time synchronization device.

[0131] The above computer-readable storage medium carries one or more programs. When the above one or more programs are executed by the time synchronization device, the time synchronization device is caused to: detect whether the obtained time service data is fraudulent time according to the local time information; and update the local time information according to the time service data in the case where the time service data is not fraudulent time.

[0132] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or it can be connected to an external computer (for example, by connecting through the Internet using an Internet service provider).

[0133] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0134] The modules involved in the embodiments described in this application can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the unit itself in some cases.

[0135] The readable storage medium provided by the embodiments of this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for performing the above-mentioned time synchronization method, and can solve the technical problem of how to improve the accuracy of timekeeping. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by this application are the same as those of the time synchronization method provided by the above embodiments, and will not be elaborated here.

[0136] An embodiment of the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the time synchronization method as described above are implemented.

[0137] The computer program product provided by the embodiment of the present application can solve the technical problem of how to improve the accuracy of time service. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the time synchronization method provided by the above embodiment, and will not be elaborated here.

[0138] The above are only partial embodiments of the present application, and do not limit the patent scope of the present application. Any equivalent structural transformation made by using the content of the specification and drawings of the present application under the technical concept of the present application, or direct / indirect application in other related technical fields shall be included in the patent protection scope of the present application.

Claims

1. A time synchronization method, characterized in that: The time synchronization method comprises: According to the local time information, detect whether the acquired timing data is fraudulent time; In the case where the timing data is not a fraudulent time, the local time information is updated according to the timing data.

2. The time synchronization method according to claim 1, characterized in that: The local time information includes local timekeeping data, and the step of detecting whether the acquired timing data is fraudulent time according to the local time information includes: Determine the local time deviation according to the timing data and the local timekeeping data; Determine the magnitude relationship between the local travel time deviation and a preset travel time error threshold; When the local time deviation is less than the time error threshold, it is determined that the timing data is not fraudulent time.

3. The time synchronization method according to claim 2, characterized in that: Before the step of determining the magnitude relationship between the local travel time deviation and a preset travel time error threshold, the method further includes: Determine the timing interval according to the timing timestamp and the local timekeeping data; The timing error threshold is determined according to the timing interval and a preset local timing error.

4. The time synchronization method according to claim 1, characterized in that: Before the step of detecting whether the acquired timing data is fraudulent time according to the local time information, the method further includes: According to the power-on flag of the local end, determine whether the local end is in the power-on state; When the local end is in a powered-on state, local time synchronization is performed to obtain synchronized local time information, and the step of detecting whether the acquired timing data is fraudulent time is performed according to the synchronized local time information; When the local terminal is not in a powered-on state, the step of detecting whether the acquired timing data is fraudulent time according to the local time information is performed.

5. The time synchronization method according to claim 1, characterized in that: Before the step of detecting whether the acquired timing data is fraudulent time according to the local time information, the method further includes: According to the stop flag of the local clock of the local end, it is determined whether the local end is in the stop state; When the local end is in a vibration-stopped state, local time synchronization is performed to obtain synchronized local time information, and the step of detecting whether the acquired timing data is fraudulent time is performed according to the synchronized local time information; When the local terminal is not in a vibration-stopping state, the step of detecting whether the acquired timing data is fraudulent time according to the local time information is performed.

6. The time synchronization method according to claim 4 or 5, characterized in that: The steps of performing local time synchronization include: Connect to the standard clock source through the preset time synchronization interface; The standard time is obtained from the standard clock source, and the local time information is synchronized according to the standard time.

7. The time synchronization method according to claim 1, characterized in that: Before the step of detecting whether the acquired timing data is fraudulent time according to the local time information, the method further includes: The received external time signal is decoded to obtain the timing data.

8. A time synchronization device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the time synchronization method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the time synchronization method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the time synchronization method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Anti-cheating interference signal processing method of GNSS time service type satellite receiver

    CN106093978A

  • Beidou anti-deception jamming method and GNSS time service type receiving device

    CN110954925A

  • Anti-cheating method and device for time service terminal

    CN111158024A

  • Time service receiver anti-cheating method and device and time service receiver

    CN115327580A

  • Time synchronization device and method

    CN117955586A