A time synchronization method, device, medium, and product

By extracting reference time information from system information messages broadcast by base stations in cellular communication systems, performing delay compensation, and switching to backup time information, the problem of time synchronization interruption caused by GNSS signal failure is solved, and the continuity and reliability of time synchronization in embedded systems and communication equipment are realized.

CN122496904APending Publication Date: 2026-07-31FIBOCOM AUTO SOFTWARE INC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FIBOCOM AUTO SOFTWARE INC
Filing Date
2026-06-23
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In embedded systems and communication equipment, GNSS signals are prone to failure in indoor, tunnel or obstructed environments, resulting in PPS unavailability, lack of reliable backup solutions, and time synchronization interruption or drift.

Method used

By receiving system information messages broadcast by base stations in the cellular communication system, extracting reference time information, performing delay compensation based on the target communication link delay, providing time synchronization services to the operating system, and switching to the compensated time information to maintain system time synchronization when the primary time source fails.

Benefits of technology

When the primary time source fails, it can reliably maintain system time synchronization, avoid time interruption and drift, and ensure the continuity and accuracy of time information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122496904A_ABST
    Figure CN122496904A_ABST
Patent Text Reader

Abstract

This application discloses a time synchronization method, device, medium, and product, comprising: receiving a system information message broadcast by a base station in a cellular communication system; extracting reference time information carried in the system information message; performing delay compensation on the reference time information based on the target communication link delay to obtain compensated time information; providing the compensated time information to the time synchronization service of the operating system; monitoring the effectiveness of the primary time source, and maintaining system time synchronization based on the compensated time information through the time synchronization service when the primary time source fails. Thus, system time synchronization can be maintained even when the primary time source fails.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a time synchronization method, device, medium and product. Background Technology

[0002] In existing embedded systems and communication devices, time synchronization is usually based on GNSS (Global Navigation Satellite System) to obtain UTC (Coordinated Universal Time) time, and high-precision time synchronization is achieved through PPS (Pulse Per Second) signals. However, GNSS signals are prone to failure in indoor, tunnel or obstructed environments, making PPS unusable.

[0003] Therefore, how to maintain system time synchronization when the primary time source fails is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a time synchronization method, device, medium, and product that can maintain system time synchronization when the primary time source fails. The specific solution is as follows: Firstly, this application provides a time synchronization method, including: Receive system information messages broadcast by base stations in cellular communication systems; Extract the reference time information carried in the system information message; The reference time information is compensated for based on the target communication link delay to obtain compensated time information. The compensated time information is provided to the operating system's time synchronization service. The system monitors the effectiveness of the primary time source. When the primary time source fails, the system maintains time synchronization based on the compensated time information through the time synchronization service.

[0005] Optional, also includes: The target communication link delay is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, wherein the system scheduling delay is the waiting time introduced by the system information message scheduling cycle.

[0006] Optionally, the target communication link delay is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, including: The communication link delay corresponding to the system information message is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message. The target communication link delay is determined based on the communication link delay sequence and a preset processing method. The communication link delay sequence includes the communication link delay corresponding to the system information message and the communication link delay corresponding to the historical system information message. The preset processing method is dynamic sliding window estimation or historical trend fitting.

[0007] Optionally, before providing the compensated time information to the operating system's time synchronization service, the method further includes: The compensated time information is subjected to stability enhancement processing, wherein the stability enhancement processing includes one or more of the following: moving average filtering, median filtering, and outlier removal.

[0008] Optionally, after receiving system information messages broadcast by base stations in a cellular communication system, the following may also be included: Record the system time when the system information message decoding is completed to obtain the target system time; Determine the time difference between the target system time and the reference time information; If the time difference is higher than a preset time difference threshold, the reference time information is discarded.

[0009] Optionally, providing the compensated time information to the operating system's time synchronization service includes: The compensated time information is written to shared memory so that the operating system's time synchronization service can read the compensated time information from the shared memory. Alternatively, a backup time reference can be provided to the operating system's time synchronization service via a preset interface.

[0010] Optional, also includes: When the primary time source is restored, the system time synchronization is maintained based on the primary time source through the time synchronization service.

[0011] Secondly, this application provides a time synchronization device, comprising: The system information message receiving module is used to receive system information messages broadcast by base stations in the cellular communication system; The reference time information extraction module is used to extract the reference time information carried in the system information message; The reference time information compensation module is used to perform delay compensation on the reference time information based on the target communication link delay to obtain the compensated time information. The compensated time information transmission module is used to provide the compensated time information to the operating system's time synchronization service; The system time synchronization module is used to monitor the effectiveness of the primary time source. When the primary time source fails, the system time synchronization is maintained based on the compensated time information through the time synchronization service.

[0012] Thirdly, this application provides an electronic device, including a memory and a processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to implement the aforementioned time synchronization method.

[0013] Fourthly, this application provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned time synchronization method.

[0014] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the aforementioned time synchronization method.

[0015] As can be seen from the above scheme, this application provides a time synchronization method, including: receiving system information messages broadcast by base stations in a cellular communication system; extracting reference time information carried in the system information messages; performing delay compensation on the reference time information based on the target communication link delay to obtain compensated time information; providing the compensated time information to the time synchronization service of the operating system; monitoring the effectiveness of the primary time source, and when the primary time source fails, maintaining system time synchronization based on the compensated time information through the time synchronization service.

[0016] Therefore, the beneficial effects of this application are as follows: Reference time information is extracted from system information messages broadcast by base stations in a cellular communication system, and delay compensation is applied to the reference time information based on the target communication link delay to obtain compensated time information, thereby ensuring the reliability of the time information. The compensated time information is then provided to the operating system's time synchronization service to monitor the effectiveness of the primary time source. When the primary time source fails, system time synchronization is maintained based on the compensated time information through the time synchronization service. Thus, by compensating for the reference time information extracted from the system information messages broadcast by the base station, system time synchronization can be maintained based on the compensated time information even when the primary time source fails.

[0017] Accordingly, the time synchronization device, equipment, readable storage medium and product provided in this application also have the above-mentioned technical effects. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0019] Figure 1 A flowchart of a time synchronization method provided in an embodiment of this application; Figure 2 A system architecture diagram of a time synchronization scheme provided in this application embodiment; Figure 3 A time synchronization flowchart provided for an embodiment of this application; Figure 4 This is a schematic diagram of a time synchronization device provided in an embodiment of this application; Figure 5 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0021] First, the terms used in this application will be explained: GNSS: A collective term encompassing systems such as GPS (Global Positioning System), BeiDou, GLONASS (Global Navigation Satellite System), and Galileo, providing global positioning and nanosecond-level time synchronization services.

[0022] PPS: High-precision second pulse signal, with rising / falling edges strictly aligned with the UTC second boundary, and errors typically in the nanosecond range, used to improve time synchronization accuracy.

[0023] SIB9 (System Information Block Type 9): One of the system information blocks in LTE (Long Term Evolution) / NR (New Radio) cellular communication systems, used to carry GNSS-related time synchronization information to help terminal equipment obtain high-precision UTC time.

[0024] RRC (Radio Resource Control) is the core control protocol in mobile communication systems, responsible for the control and configuration of radio resources such as connection management between terminals and base stations, system information broadcasting, measurement and control, and handover.

[0025] UTC: A globally used time standard, based on TAI (International Atomic Time) adjusted for leap seconds to keep pace with the Earth's rotation. It serves as the time reference for NTP (Network Time Protocol), PTP (Precision Time Protocol), and GNSS systems.

[0026] SHM (Shared Memory): An IPC (Inter-Process Communication) mechanism in the operating system that allows multiple processes to directly access the same memory region. It is often used in NTP / chrony to achieve efficient data exchange.

[0027] chrony (time synchronization service): An NTP client / server program for Linux systems, offering fast synchronization speeds, strong resistance to network jitter, and support for hardware clocks and reference sources such as PPS / GNSS.

[0028] gPTP (Generalized Precision Time Protocol): The PTP profile defined by the IEEE 802.1AS standard is designed specifically for AVB (Audio Video Bridging) and TSN (Time Sensitive Networking) to achieve high-precision time synchronization in Ethernet bridged networks.

[0029] In existing embedded systems and communication devices, time synchronization mainly relies on the following methods: obtaining UTC time based on GNSS (such as GPS / BeiDou) and achieving high-precision time synchronization through PPS signals; achieving high-precision time synchronization within a local area network based on the gPTP protocol; and obtaining time through a public NTP clock source server to calibrate the system clock.

[0030] In existing technologies, GNSS signals are prone to failure in indoor, tunnel, or obstructed environments, rendering PPS unusable. The system lacks a reliable backup plan after the primary time source fails, leading to time drift or interruption.

[0031] See Figure 1 As shown in the figure, this application discloses a time synchronization method, including: Step S11: Receive system information messages broadcast by base stations in the cellular communication system.

[0032] The system information message is a System Information Block (SIB), preferably SIB9 (i.e., System Information Block 9), periodically sent by the base station through the broadcast control channel. SIB9 carries UTC time, i.e., reference time information. This embodiment can periodically receive SIB9 broadcasts from the RRC layer. In cellular communication systems, 3GPP Release 16 defines System Information Block SIB9 for broadcasting UTC time and leap second information through the RRC layer. Terminal devices can receive this information without establishing a dedicated connection. However, in the prior art, SIB9 is only used for protocol layer time display or simple reading and is not used for operating system-level time synchronization.

[0033] Step S12: Extract the reference time information carried in the system information message.

[0034] This embodiment can extract UTC time from system information messages, obtain and record reference time information, and can also record system frame number (SFN), subframe information, etc.

[0035] This application embodiment can record the system time when the system information message decoding is completed to obtain the target system time; determine the time difference between the target system time and the reference time information; if the time difference is higher than a preset time difference threshold, then discard the reference time information.

[0036] It is understood that if the preset time difference threshold is exceeded, it may indicate a broadcast anomaly or a delay anomaly, and the data in this embodiment may be discarded. The preset time difference threshold can be an empirical value.

[0037] Step S13: Perform delay compensation on the reference time information based on the target communication link delay to obtain the compensated time information.

[0038] In other words, the embodiments of this application can compensate for the delay of reference time information based on the delay of system information messages on the communication link, so as to ensure that the time information provided to the time synchronization service is reliable.

[0039] In one implementation, the target communication link delay is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, wherein the system scheduling delay is the waiting time introduced by the system information message scheduling cycle.

[0040] The air interface propagation delay can be calculated based on the distance between the base station and the terminal. Dividing the distance between the base station and the terminal by the speed of light yields the air interface propagation delay, which can be determined using GNSS or signal ranging. The protocol stack decoding delay can be obtained from the hardware / protocol stack or by measuring the time from SIB9 reaching the PHY (Physical Layer) to decoding completion, and can be estimated using an average value or a sliding window. The system scheduling delay is the waiting time introduced by the periodic scheduling of SIB9 in LTE. The SIB9 period (typically 80ms) can be found in 3GPP documents, and the offset can then be estimated. The deviation between the transmission and reception periods can be determined to obtain the system scheduling delay. This avoids errors introduced by air interface transmission delay, decoding delay, and system scheduling delay, improving time accuracy.

[0041] In one implementation, determining the target communication link delay based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message may include: determining the communication link delay corresponding to the system information message based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message; determining the target communication link delay based on a communication link delay sequence and using a preset processing method, wherein the communication link delay sequence includes the communication link delay corresponding to the system information message and the communication link delay corresponding to historical system information messages, and the preset processing method is dynamic sliding window estimation or historical trend fitting.

[0042] This embodiment calculates the sum of air interface propagation delay, protocol stack decoding delay, and system scheduling delay to obtain the communication link delay corresponding to the current system information message. Based on the communication link delay sequence and a preset processing method, the target communication link delay is determined. Specifically, dynamic sliding window estimation involves calculating the statistical average or median of the most recent N communication link delays and dynamically updating the target communication link delay. The window slides over time, discarding old communication link delays and adding new ones, achieving adaptive smoothing. Historical trend fitting uses a linear / polynomial model to predict future values. The target communication link delay can be determined based on the predicted value of the current communication link delay and the calculated communication link delay, such as through weighted calculation. This avoids the influence of fluctuations in reference time information and further improves time synchronization accuracy.

[0043] In other alternative implementations, a fixed target communication link delay can be used, the value of which was obtained experimentally.

[0044] In one embodiment, before providing the compensated time information to the operating system for time synchronization, the method may further include: performing stability enhancement processing on the compensated time information, wherein the stability enhancement processing includes one or more of the following: moving average filtering, median filtering, and outlier removal.

[0045] Among them, an outlier can be defined as: if the difference between the current compensated time information and the previous compensated time information is higher than the preset difference threshold, then the current compensated time information is judged as an outlier.

[0046] Step S14: Provide the compensated time information to the operating system's time synchronization service.

[0047] In an optional embodiment, the compensated time information can be provided to the operating system's time synchronization service, including: writing the compensated time information into shared memory so that the operating system's time synchronization service can read the compensated time information from the shared memory; or, providing a backup time reference to the operating system's time synchronization service through a preset interface.

[0048] That is, in this embodiment of the application, the compensated time information can be written into shared memory, and the operating system's time synchronization service can obtain a time reference by reading the shared memory. Alternatively, the compensated time information can be sent to the operating system's time synchronization service through a preset interface.

[0049] Step S15: Monitor the effectiveness of the primary time source. When the primary time source fails, maintain system time synchronization based on the compensated time information through the time synchronization service.

[0050] Furthermore, when the primary time source is restored, the system time synchronization is maintained based on the primary time source through the time synchronization service.

[0051] The primary time source includes, but is not limited to, GPS PPS signals, GNSS clocks, or other high-precision time sources. The validity of the primary time source can be determined by monitoring the pulse arrival status of the PPS signal or the GNSS lock status. When the primary time source is valid, it serves as the system time reference, and the operating system's time synchronization service maintains system time synchronization using this primary time source. When the primary time source fails (e.g., GPS signal loss, PPS interruption), the system switches to a backup time reference, i.e., compensated time information. In this case, the operating system's time synchronization service maintains system time synchronization based on the compensated time information using a slew adjustment strategy. The slew adjustment strategy fine-tunes the local clock frequency, causing the system time to gradually converge to the backup time reference, thus avoiding time jumps.

[0052] Furthermore, once the primary time source is restored and stabilized (e.g., GPS relocks, PPS remains normal for N consecutive cycles), the system smoothly switches back to the primary time source via the time synchronization service. This switchback process also employs a smooth adjustment strategy to avoid time jumps when switching back from the backup time reference to the primary time source.

[0053] In optional implementations, the embodiments of this application may further include: verifying the legality of the reference time information, setting a time deviation threshold limit to prevent time injection from abnormal base stations; and introducing a time source credibility assessment mechanism.

[0054] In one embodiment, applied to a vehicle-mounted system: GNSS provides the PPS signal; the PPS is lost after the vehicle enters the tunnel; the system switches to SIB9 time; after compensation and filtering, it is provided to chrony; the PPS is restored and smoothly switched after the vehicle exits the tunnel.

[0055] In one embodiment, this is applied to an indoor communication terminal: GNSS is unavailable for an extended period; the terminal continuously receives SIB9; time is corrected using a compensation model; a system clock is provided; and log time consistency is ensured. The log is the system log, and the timestamp in the system log is actually the system time. When the system time is sufficiently stable, the log time will also be sufficiently stable and monotonically increasing.

[0056] In one embodiment, applied to a 5G communication module, the module parses SIB9 at the RRC layer; outputs the time to user-space shared memory; chrony (i.e., time synchronization service) reads the time source; synchronizes with the system time; and automatically switches the primary source when GNSS recovers.

[0057] As can be seen, this embodiment extracts reference time information from system information messages broadcast by base stations in a cellular communication system, and performs delay compensation on the reference time information based on the target communication link delay to obtain compensated time information, thereby ensuring the reliability of the time information. The compensated time information is then provided to the operating system's time synchronization service to monitor the effectiveness of the primary time source. When the primary time source fails, the system time synchronization is maintained based on the compensated time information through the time synchronization service. Thus, by compensating for the reference time information extracted from the system information messages broadcast by the base station, system time synchronization can be maintained based on the compensated time information even when the primary time source fails.

[0058] The following section uses SIB9 system information messages as an example to further illustrate the time synchronization scheme provided in this application. Based on 3GPP SIB9 information, backup time synchronization is achieved by performing protocol-level parsing, time alignment, delay compensation, and filtering on the SIB9 broadcast time, converting it into a time source usable by the operating system. This allows for smooth switching when the primary time source fails, thereby solving the problems of time synchronization interruption and time discontinuity. (See also...) Figure 2 As shown, Figure 2 This is a system architecture diagram of a time synchronization scheme provided in an embodiment of this application. Figure 2 The embedded devices mentioned refer to the same embedded device, indicating synchronization within the same embedded device (such as a 5G module). This can be achieved using... Figure 2 There are two methods for synchronizing time. One method is the conventional approach, and the other is the SIB9 backup time synchronization method described in this application.

[0059] The system includes the following functional modules: GNSS / PPS main time source module, SIB9 reception and parsing module (based on RRC layer), time alignment and delay compensation module, time filtering module, time source management and switching module, and time synchronization service module (chrony). Preparatory work can be performed in advance, including: configuring the cellular communication module to support SIB9 information acquisition; opening the RRC layer SIB9 data interface in the protocol stack; deploying the SIB9 parser (user space or kernel space); and configuring chrony to support SHM or SOCK (socket) time sources. chrony is a Linux system time synchronization tool. Synchronizing the system time requires writing time data to chrony; the closer the written time is to the actual time, the higher the accuracy of the synchronized system time. SHM or SOCK refers to the ability of other applications to write time data to the SHM or SOCK interface after configuring chrony, allowing chrony to use the time data to synchronize the system time. In other words, after obtaining and filtering the SIB9 time, the time data can be written to chrony.

[0060] See Figure 3 As shown, Figure 3 A time synchronization flowchart provided for embodiments of this application may include the following specific implementation steps: Step 1: SIB9 Information Acquisition (Protocol Layer): Periodically receive SIB9 broadcasts from the RRC layer; extract the following fields: UTC time (i.e., the aforementioned reference time information), system frame number (SFN), and subframe information (if present).

[0061] Step 2: Time Reception Alignment: Record two key times: a) T_rx: System time when SIB9 decoding is complete; b) T_sib: UTC time carried in SIB9; Establish a time relationship model: T_real = T_sib + Δt_offset. T_real represents the compensated time information, and Δt_offset is the target communication link delay.

[0062] Step 3: Delay Compensation Calculation: The delay compensation includes: a) air interface propagation delay; b) RRC decoding delay; c) system scheduling delay. The compensation model is as follows: = f(air_delay, decode_delay, scheduling_delay); where air_delay is the air interface delay propagation, decode_delay is the RRC decoding delay, scheduling_delay is the system scheduling delay, and f represents an addition operation that sums the three delays. The communication link delay represents the k-th iteration. `air_delay`, `decode_delay`, and `scheduling_delay` are all the k-th delay, i.e., the delay of the current period. Compensation methods include: dynamic sliding window estimation; historical error fitting; and exponentially weighted moving average. Delay compensation calculation can also use fixed offset compensation, meaning the target communication link delay is not subject to the above compensation models but is an experimentally obtained value. `air_delay` is usually calculated based on the base station-terminal (i.e., embedded device) distance: `air_delay ≈ d / c`, where `d` is the distance (which can be measured via GNSS or signal ranging); and `c` is the speed of light ≈ 3 × 10^8 m / s; for LTE cells, this is typically tens to hundreds of microseconds. `decode_delay` is obtained from the hardware / protocol stack or by measuring the time from when SIB9 reaches the PHY layer to when decoding is complete; it can be estimated using an average value or a sliding window. `scheduling_delay` is the waiting time introduced by the periodic scheduling of SIB9 in LTE; the SIB9 period (typically 80 ms) can be found in 3GPP documents, and then the offset is estimated.

[0063] The formula for determining the exponentially weighted moving average is as follows: α∈[0,1], is the smoothing factor (which can be 0.7). 0.9); The smoothed output value of the previous cycle is the target communication link delay of the previous cycle. This represents the target communication link delay for this period. Furthermore, it can be... Assign the value to Δt_offset.

[0064] The formula for determining the average value using a simple sliding window is as follows: N represents the window size (e.g., N=10), kj: the time index of the most recent N samples (j=0 for the current, j=N-1 for the earliest).

[0065] Historical trend fitting: , where a represents the slope and b represents the intercept, is The time variable for the (k+1)th time step is the next sampling time. If t takes the period index, then... =N (window length); if the absolute time is taken, it is the time from the (k+1)th reception time to the start of the fitting window. This represents the target communication link delay at k+1 times.

[0066] Step 4: Time Stability Enhancement: Processing the compensated time information: a) Moving average filtering; b) Median filtering; c) Outlier removal. In this embodiment, the compensated time information of the current period and the historical compensated time information constitute a continuous time series. Filtering can smooth out jitter and remove sudden outliers. Outliers are time deviations that exceed a statistical threshold. If the absolute value of the difference between the current compensated time information and the previous compensated time information is higher than the threshold, it is considered an outlier. This threshold can be an empirical value, thereby removing time information such as base station time jumps and network latency anomalies. Moving average can reduce short-term jitter, median filtering can resist occasional outliers, and outlier removal can remove points with excessively large differences from previous and subsequent values.

[0067] Step 5: Time source output: Write the processed time to shared memory (SHM); or provide it to chrony via a custom refclock interface.

[0068] Step 6: Primary / Backup Time Source Switching: If PPS is normal, use PPS as the primary time source; if PPS fails, switch to SIB9 time and use slew to smoothly adjust the time. When PPS recovers: smoothly switch back. Chrony can evaluate the effectiveness and accuracy of the current clock source. When PPS changes from invalid to effective, its accuracy can reach the 1~10µs level, and it will smoothly switch to a higher-precision PPS clock source. SIB9 is at the millisecond level. Slew (gradual adjustment) is a technique that corrects time deviations by fine-tuning the clock frequency, as opposed to a direct step, which directly modifies the system clock value. Slew adjusts the clock operating frequency (speeding up or slowing down).

[0069] This embodiment can continuously synchronize and periodically update the SIB9 time, continuously providing it to chrony to maintain system time continuity. That is, it continuously writes the filtered SIB9 time to chrony.

[0070] This embodiment can be tested and verified. The test content may include: 1) verification of the correctness of SIB9 time resolution; 2) test of delay compensation effect; 3) test of PPS failure switching; 4) verification of time continuity (no step jump); 5) test of long-term running stability.

[0071] The SIB9 time resolution correctness verification is used to confirm that the UTC / SFN / subframes resolved from the SIB9 obtained from the RRC layer are semantically correct, numerically correct, and time-consistent. Testing methods can include: static consistency testing (offline verification), which uses known SIB9 logs (packet capture or base station simulation) to compare with standard references (3GPP specifications or base station output) to check: whether the UTC field is correctly resolved (year, month, day, hour, minute, second), whether the SFN is within the legal range: LTE: 0~1023 cycles, and whether the subframe is within 0~9; and time monotonicity testing (online), which involves continuous sampling to check for no backtracking. The judgment criteria are: correct resolution should meet the following: valid UTC format (no illegal times such as 25:70:90), SFN conforms to the 3GPP range, SFN increments or cycles are consistent, subframes match SFN (no misalignment or jumps), and the time difference with GNSS should not increase divergently (otherwise, resolution will be misaligned).

[0072] The delay compensation effect test is used to verify whether the compensation model truly reduces errors. Test method: Benchmark comparison method (core), requiring a true reference standard: GNSS PPS or high-precision PTP Grandmaster. The difference between the SIB9 corrected time (i.e., the compensated time information) and the reference standard is calculated as the error, and the effect is judged based on the error. 2) Compare the first error between the uncompensated time information and the reference standard, and the second error between the compensated time information and the reference standard. If the mean of the first error is higher than the mean of the second error, and the variance of the first error is higher than the variance of the second error, it can be judged as effective.

[0073] The PPS failure handover test is used to verify whether the system can smoothly switch to SIB9 after PPS failure. Test method: Manually disconnect the PPS input, unplug the GNSS PPS signal, or disable the PPS driver in software; observe the chrony behavior, monitor the time source switching log, and judge the criteria: no time step, PPS failure and SIB9 takeover time.

[0074] Time continuity verification (no step jump) is used to verify that the system time will not skip seconds under any circumstances. Test method: Record the system clock (system time) for an extended period, simultaneously recording SIB9 time and PPS time; detect time differences. Calculate the difference ΔT between the current system time and the previous system time. The criterion is: ΔT ≈ 1s (or a smooth increase in the order of 100ms) indicates continuity.

[0075] Long-term stability test: Test method: 24h / 72h / 7d operation, drift rate analysis: drift = drift(offset) / dt, judgment criterion: drift is close to 0 (or stable within a small range). offset(t2) is the time offset at time t2, which can be the difference between the local system time and the SIB9 compensated time information at the end of the test. offset(t1) is the time offset at time t1, which is the difference between the local system time and the SIB9 compensated time at the start of the test. drift(offset) is the difference between offset(t2) and offset(t1), and dt is the difference between t2 and t1.

[0076] Furthermore, to enhance security, the following strategies can be implemented: verify the validity of SIB9 time; set a time deviation threshold limit; prevent time injection from abnormal base stations; and introduce a time source credibility assessment mechanism.

[0077] The validity of SIB9 time is verified immediately after parsing. After the SIB9 decoding is completed at the RRC layer and before any time calculation is entered, the original fields are first statically verified: (1) UTC time validity verification, check that the year is not lower than the preset starting point (e.g., ≥2020), the month range is 1–12, the date range is 1–31, and the second range is 0–59 (including leap second policy compatibility); if there are obvious illegal values ​​(e.g., 2099-99-99, 1970 caused by GNSS abnormal wrap-around, etc.), the SIB9 sample is directly discarded. (2) System frame number (SFN) validity verification, verification is performed on the frame number range of LTE / NR system: the LTE system frame number should be in the cyclic range of 0–1023; the NR system frame number should be in the valid range of the current system configuration; SFNs that exceed the valid range are regarded as protocol abnormalities and the sample is rejected. (3) Time consistency coarse check: calculate the absolute difference between the UTC time (T_sib) carried by SIB9 and the GNSS time; if the difference exceeds the preset threshold (e.g., 1–5 seconds, adjustable in engineering), it is determined to be time inconsistent and the sample is discarded.

[0078] Furthermore, setting time deviation threshold limits can be achieved during delay compensation and stability enhancement processes by setting instantaneous thresholds and rate of change thresholds to prevent abnormal samples from entering subsequent synchronization links: (1) Instantaneous deviation threshold: For each calculated compensated time information, check its deviation from the local received time; if the absolute deviation exceeds the preset upper limit (such as 100 ms or 500 ms), directly reject the sample to avoid a single abnormal impact on system time. (2) If the rate of change of the compensated time information is higher than the rate of change threshold, the compensated time information is unreliable. The rate of change is the ratio of the time difference between two adjacent compensated time information values.

[0079] To prevent time injection from abnormal base stations, base station identity binding and whitelist verification can be implemented. This involves binding and verifying the received SIB9 with the identifier of the current serving cell, including the cell ID, tracking area code (TAC), and public land mobile network (PLMN). A whitelist of legitimate base stations can be established, accepting only time information broadcast by base stations on the whitelist and rejecting time synchronization data from unfamiliar or illegal base stations. In other words, the base station identifier in system information messages is verified based on the whitelist; data that fails verification is discarded. Time continuity constraints can also be implemented: the difference between two consecutive parsed T_sib values ​​must be less than a preset threshold; otherwise, the data is discarded. Cross-source consistency verification can be performed. When other time sources exist in the system (such as GNSS and PPS), the difference between the SIB9-compensated time and the GNSS / PPS time is periodically compared. If the difference exceeds the allowable range, the SIB9 time source is deemed untrustworthy, and the backup channel is downgraded or blocked until the difference returns to a reasonable range. GNSS time is Tgnss, PPS time is Tpps, and SIB9 time is Tsib. Further judgment conditions can be used if... SIB9 is deemed unreliable. "Much greater than" means the difference between the two values ​​exceeds a specific threshold, which is an empirical value. GNSS time is the absolute time value output by the GNSS receiver (e.g., GPS time). PPS time is the integer second corresponding to the edge of the PPS pulse.

[0080] A time source reliability assessment mechanism is introduced, focusing on stability (variance): lower jitter scores higher; accuracy (comparison with GNSS / PPS); and continuity (whether there are jumps): steps significantly deduct points. The SIB9 time source undergoes continuous reliability assessment, rather than a one-time judgment. For example, the jitter variance of the compensated time information can be statistically analyzed; smaller variance indicates more stable SIB9 time and a higher stability score. Using the GNSS / PPS main time source as a benchmark, the average deviation between multiple SIB9 compensated times and the benchmark time is calculated; smaller deviations result in higher accuracy scores. The mechanism monitors for step jumps or abnormal rejection events during time synchronization; each jump or anomaly deducts from the continuity score, gradually restoring continuity after multiple consecutive normal cycles. The overall reliability score of the time source is calculated based on these three dimensions. When the reliability score falls below a preset threshold, the current SIB9 compensated time is automatically discarded to ensure system time security is not affected by low-quality backup sources.

[0081] This application introduces SIB9 broadcast time into operating system-level time synchronization; constructs a complete link from the RRC protocol layer to the system clock; proposes an SIB9 time alignment and delay compensation model; and realizes the fusion and switching of the SIB9 time source and the PPS time source. In terms of reliability, a backup mechanism is provided in case of primary time source failure to avoid time synchronization interruption and ensure system time continuity. In terms of engineering implementation, it can be directly deployed on Linux systems and seamlessly integrated with chrony; it is suitable for vehicle-mounted, module-based, and IoT devices. By introducing SIB9 as a backup time source, it achieves: maintaining time synchronization in GNSS failure scenarios; avoiding system time abrupt changes or rollbacks; improving the reliability and continuity of system time synchronization; and expanding the application value of cellular networks in the field of time synchronization.

[0082] See Figure 4 As shown in the diagram, this application provides a schematic diagram of a time synchronization device. The time synchronization device may include: System information message receiving module 11 is used to receive system information messages broadcast by base stations in the cellular communication system; Reference time information extraction module 12 is used to extract reference time information carried in the system information message; Reference time information compensation module 13 is used to perform delay compensation on the reference time information based on the target communication link delay to obtain compensated time information; The compensation time information transmission module 14 is used to provide the compensated time information to the time synchronization service of the operating system; The system time synchronization module 15 is used to monitor the effectiveness of the main time source. When the main time source fails, the system time synchronization is maintained based on the compensated time information through the time synchronization service.

[0083] The device may further include: The delay determination module is used to determine the target communication link delay based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, wherein the system scheduling delay is the waiting time introduced by the system information message scheduling cycle.

[0084] The delay determination module can be specifically used to: determine the communication link delay corresponding to the system information message based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message; determine the target communication link delay based on the communication link delay sequence and using a preset processing method, wherein the communication link delay sequence includes the communication link delay corresponding to the system information message and the communication link delay corresponding to historical system information messages, and the preset processing method is dynamic sliding window estimation or historical trend fitting.

[0085] The device further includes a stability enhancement processing module, used to perform stability enhancement processing on the compensated time information before providing the compensated time information to the operating system's time synchronization service, wherein the stability enhancement processing includes one or more of moving average filtering, median filtering, and outlier removal.

[0086] The device may further include an anomaly detection module, which, after receiving a system information message broadcast by a base station in a cellular communication system, records the system time when the system information message is decoded to obtain a target system time; determines the time difference between the target system time and the reference time information; and discards the reference time information if the time difference is higher than a preset time difference threshold.

[0087] The time compensation information transmission module 14 can be specifically used to: write the compensated time information into shared memory so that the operating system's time synchronization service can read the compensated time information from the shared memory; or, provide a backup time reference to the operating system's time synchronization service through a preset interface.

[0088] The system time synchronization module is also used to maintain system time synchronization based on the main time source through the time synchronization service when the main time source is restored.

[0089] See Figure 5 As shown in the figure, this application discloses an electronic device 20, including a processor 21 and a memory 22; wherein, the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, the time synchronization method disclosed in the foregoing embodiments.

[0090] For details regarding the specific process of the above time synchronization method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0091] Furthermore, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, and the storage method can be temporary storage or permanent storage.

[0092] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26; wherein, the power supply 23 is used to provide operating voltage for the various hardware devices on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0093] Furthermore, embodiments of this application also disclose a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the time synchronization method disclosed in the foregoing embodiments.

[0094] For details regarding the specific process of the above time synchronization method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0095] Furthermore, embodiments of this application provide a computer program product, including a computer program / instructions, which, when executed by a processor, implement the time synchronization method disclosed in the foregoing embodiments.

[0096] For details regarding the specific process of the above time synchronization method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0097] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0098] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0099] The above provides a detailed description of the time synchronization method, device, medium, and product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A time synchronization method, characterized in that, include: Receive system information messages broadcast by base stations in cellular communication systems; Extract the reference time information carried in the system information message; The reference time information is compensated for based on the target communication link delay to obtain compensated time information. The compensated time information is provided to the operating system's time synchronization service. The system monitors the effectiveness of the primary time source. When the primary time source fails, the system maintains time synchronization based on the compensated time information through the time synchronization service.

2. The time synchronization method according to claim 1, characterized in that, Also includes: The target communication link delay is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, wherein the system scheduling delay is the waiting time introduced by the system information message scheduling cycle.

3. The time synchronization method according to claim 2, characterized in that, The target communication link delay is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message, including: The communication link delay corresponding to the system information message is determined based on the air interface propagation delay, protocol stack decoding delay, and system scheduling delay corresponding to the system information message. The target communication link delay is determined based on the communication link delay sequence and a preset processing method. The communication link delay sequence includes the communication link delay corresponding to the system information message and the communication link delay corresponding to the historical system information message. The preset processing method is dynamic sliding window estimation or historical trend fitting.

4. The time synchronization method according to claim 1, characterized in that, Before providing the compensated time information to the operating system for time synchronization, the process also includes: The compensated time information is subjected to stability enhancement processing, wherein the stability enhancement processing includes one or more of the following: moving average filtering, median filtering, and outlier removal.

5. The time synchronization method according to claim 1, characterized in that, After receiving system information messages broadcast by base stations in a cellular communication system, the process also includes: Record the system time when the system information message decoding is completed to obtain the target system time; Determine the time difference between the target system time and the reference time information; If the time difference is higher than a preset time difference threshold, the reference time information is discarded.

6. The time synchronization method according to claim 1, characterized in that, Providing the compensated time information to the operating system's time synchronization service includes: The compensated time information is written to shared memory so that the operating system's time synchronization service can read the compensated time information from the shared memory. Alternatively, a backup time reference can be provided to the operating system's time synchronization service via a preset interface.

7. The time synchronization method according to any one of claims 1 to 6, characterized in that, Also includes: When the primary time source is restored, the system time synchronization is maintained based on the primary time source through the time synchronization service.

8. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the time synchronization method as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, Used to store a computer program, wherein the computer program, when executed by a processor, implements the time synchronization method as described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the time synchronization method as described in any one of claims 1 to 7.