A time synchronization protection method for a fusion terminal and related products

CN123010973APending Publication Date: 2026-10-30JIANGYIN CHANGYI GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611297233.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0008]为解决现有技术中系统式中调整导致的任务调度错乱、数据确实以及采集风暴等技术问题,本发明在如下的多个方面中提供方案

Benefits of technology

[0019]本发明的有益效果在于:本发明通过解耦系统时钟与调度计时,实现了任务调度间隔计算对系统校时操作的免疫,消除了时间回退引发的任务推迟与卡死问题;通过去抖检测与低优先级异步追补机制,既能够自动恢复因时间跳变丢失的历史数据,又避免了突发采集风暴对系统资源的挤占;通过三层校验与隔离存储防护,确保了写入数据时间戳的物理准确性与一致性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123010973A_ABST
    Figure CN123010973A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of power fusion terminal, and particularly relates to a time synchronization protection method for a fusion terminal and related products, which comprises configuring a monotonic clock and a system clock in a terminal device; calculating the execution interval of a timing task based on the monotonic clock and triggering task scheduling; periodically detecting the offset change of the system clock and the monotonic clock, and determining that a time jump event occurs when the offset change reaches a set threshold; determining the affected missing task period within the jump time window, and generating a compensation task with a theoretical trigger timestamp based on the missing task period; injecting the compensation task into the scheduling queue, executing the compensation task asynchronously at a scheduling priority lower than that of a normal period task, and storing the generated to-be-written data and its corresponding theoretical trigger timestamp in association. The present application can effectively isolate the influence of clock jump, and take into account historical missing data compensation and current acquisition flow protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power convergence terminal technology. More specifically, this invention relates to a time synchronization protection method and related products for convergence terminals. Background Technology

[0002] As a core edge computing node in IoT architectures such as power marketing data collection systems, converged terminals undertake critical responsibilities including power data collection, timed data freezing (such as daily and monthly freezing), proactive data reporting, and responding to meter reading requests from the master station. The normal operation of these terminal devices highly depends on an accurate and continuous system clock; all time-triggered tasks are scheduled and executed based on the system clock.

[0003] In actual field operation environments, the system clock of a fusion terminal may be dynamically calibrated or adjusted due to reasons such as remote master station time synchronization, local manual time synchronization by maintenance personnel, NTP / SNTP network time synchronization, or re-acquisition of satellite positioning modules (such as GPS / BeiDou) after lock-on. When the clock is calibrated, there are usually two situations: system time rollback (adjustment backward) or system time jump forward (jump forward).

[0004] (1) Time rollback scenario: If task scheduling directly relies on the system clock to calculate the execution interval, time rollback will cause the calculation of the next trigger time to have a negative value or a maximum value, resulting in serious delay of the task or missing the execution cycle; at the same time, the timestamp of the generated frozen data will be reversed or duplicated, which will destroy the time series continuity of the data.

[0005] (2) Time jump / multi-cycle scenario: A large time jump will cause multiple cycle timed tasks to be triggered explosively in a very short time, causing a "collection storm", resulting in communication channel congestion and equipment freezing; or directly skipping a specific freeze time, resulting in permanent loss and disconnection of key frozen data.

[0006] Existing technologies typically employ simple clock overwrite or global reset mechanisms, which not only fail to recover historical data lost due to clock transitions but also cause secondary impacts on currently running normal business operations.

[0007] Therefore, how to provide a time synchronization protection mechanism that can effectively isolate the impact of clock jumps and take into account both the recovery of missing historical data and the protection of current data collection traffic is a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0008] To address the technical problems of task scheduling disorder, data inaccuracy, and data acquisition storms caused by system-wide adjustments in existing technologies, this invention provides solutions in the following aspects.

[0009] In a first aspect, the present invention provides a time synchronization protection method for a converged terminal, comprising: step S1: configuring an independently operating monotonic clock and a system clock in the terminal device, wherein the monotonic clock is monotonically increasing and unaffected by system time calibration; step S2: calculating the execution interval of a timing task based on the monotonic clock and triggering task scheduling; step S3: periodically detecting the offset change between the system clock and the monotonic clock, and determining that a time jump event has occurred when the offset change reaches a set threshold; step S4: in response to the time jump event, determining the affected missing task cycle within the jump time window, and generating a compensation task with a theoretical trigger timestamp based on the missing task cycle; step S5: injecting the compensation task into a scheduling queue, executing the compensation task asynchronously with a scheduling priority lower than that of normal cycle tasks, and storing the generated data to be written in association with its corresponding theoretical trigger timestamp.

[0010] Further, in step S2, calculating the execution interval of the timing task based on the monotonic clock and triggering task scheduling includes: recording the monotonic clock timestamp and the system clock timestamp when the task was last scheduled for execution; calculating the task execution interval based only on the difference between the current monotonic clock timestamp and the monotonic clock timestamp when the task was last scheduled for execution; and activating the task when the difference reaches the configured execution cycle.

[0011] Further, in step S3, the periodic detection of the offset change between the system clock and the monotonic clock includes: calculating the current offset between the system clock and the monotonic clock at the current moment, and calculating the change of the current offset relative to the reference offset; when the change exceeds a set threshold, entering an observation window of a set duration; accumulating subsequent changes within the observation window, and issuing a merged time jump event when the observation window ends and there is no reverse oscillation.

[0012] Further, in steps S4 and S5, the steps of generating and executing the compensation task include: determining the transition window formed by the system clock time before the transition and the system clock time after the transition; traversing the task configuration table, aligning the execution cycle boundaries, and identifying the unexecuted missing cycles within the transition window; constructing a compensation context including a theoretical trigger timestamp and a compensation priority for each missing cycle, and injecting the compensation context into the scheduling queue; when executing the compensation task, extracting the theoretical trigger timestamp from the compensation context as the timestamp source for generating frozen data.

[0013] Furthermore, the method also includes a verification and protection step before data writing, including: monotonicity verification: determining whether the timestamp of the data to be written is greater than the latest timestamp of the same stored data item; otherwise, the writing is rejected; window verification: determining whether the timestamp of the data to be written falls within a preset reasonable generation time window; cross-verification: comparing the timestamp of the scheduling system clock recorded during task execution with the timestamp of the data to be written to determine whether the deviation exceeds the allowable range; when the data to be written fails the window verification or cross-verification, the data is marked as suspicious data and written to a preset suspicious data isolation area.

[0014] Furthermore, the method also includes a degradation processing step for continuous jumps: counting the number of consecutive time jump events within a set time period; when the number of consecutive events reaches a preset degradation threshold, entering degradation mode, pausing the automatic generation of compensation tasks, and marking the data generated during this period with a suspicious identifier.

[0015] Furthermore, the method also includes a data query request response correction step: receiving an external data query request and parsing the target time period; if a time jump is detected within the target time period or within a predetermined time range prior to it, correcting the response according to the following rules: if a positive time jump occurs, extending the start time of the query request period forward to the time before the jump; appending a data quality annotation to the response message, the data quality annotation including at least one of a timestamp verification status identifier, a credibility level, or a compensation data marker.

[0016] In a second aspect, the present invention also provides a time synchronization protection device, comprising: a dual-clock module: configured with a monotonic clock unaffected by system time adjustment and a system clock for external communication; a scheduling module: calculating the task execution interval based on the monotonic clock and triggering task scheduling; a jump detection module: periodically detecting the offset change between the system clock and the monotonic clock and determining a time jump event; a compensation scheduling module: calculating the missing period within the jump window based on the time jump event, generating a compensation task carrying a theoretical trigger timestamp, and injecting it into the scheduling module with a priority lower than that of normal tasks; and a data protection module: verifying the validity of the data timestamp before writing the data to storage and isolating and storing data with abnormal verification.

[0017] In a third aspect, the present invention also provides a terminal device, including a processor and a memory storing a computer program, wherein the processor, when executing the computer program, implements the time synchronization protection method for a converged terminal as described in one or more embodiments of the first aspect.

[0018] In a fourth aspect, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the time synchronization protection method for a converged terminal as described in one or more embodiments of the first aspect.

[0019] The beneficial effects of this invention are as follows: By decoupling the system clock and the scheduling timer, this invention achieves immunity to system time synchronization operations in task scheduling interval calculation, eliminating the task delay and freezing problems caused by time rollback; through debouncing detection and low-priority asynchronous compensation mechanism, it can automatically recover historical data lost due to time jumps, and avoid the crowding of system resources by sudden acquisition storms; through three-layer verification and isolated storage protection, it ensures the physical accuracy and consistency of the written data timestamps. Attached Figure Description

[0020] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent upon reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of the invention are illustrated by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts, wherein: Figure 1 This is a flowchart illustrating a time synchronization protection method for a fusion terminal according to an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the composition of a terminal device according to an embodiment of the present invention. Detailed Implementation

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

[0022] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0023] This invention provides a time synchronization protection method for converged terminals under a general architecture. For example... Figure 1 As shown, the method mainly includes the following steps: Step S1, Configure Dual Clock Bases: Configure an independently operating monotonic clock and a system clock in the terminal device (e.g., memory). The monotonic clock is strictly monotonically increasing and unaffected by system time calibration commands. It can be used for task execution interval calculation (ShouldActivate), subtask execution timeout judgment, scheduler internal timestamps, performance statistics, and log timestamps. The system clock is the externally modifiable display and communication time. It can be used for freezing data timestamps, data acquisition timestamps, data reporting period identifiers, time fields in external communication protocols, and human-machine interface display time.

[0024] In one application scenario, a monotonic clock is based on a relative time count after system startup. Typical implementations include: (1) CLOCK_MONOTONIC: In the Linux environment, clock_gettime(CLOCK_MONOTONIC) is used to obtain the clock. This clock starts counting from the system startup and is not affected by the two key functions settimeofday (immediately set the system time) and adjtime (gradually fine-tune the system time), but is affected by the NTP (Network Time Protocol) frequency adjustment (the magnitude is usually very small). (2) Hardware Tick Counting: Directly read the CPU clock cycle count (such as the RDTSC instruction), or read the Tick value of the hardware timer and convert it into a nanosecond-level timestamp in combination with the Tick frequency; (3) Comprehensive solution: CLOCK_MONOTONIC is the main solution, supplemented by hardware Tick verification. When the deviation between the two exceeds the threshold, the hardware Tick shall be used as the standard and the abnormal log shall be recorded.

[0025] Step S2, Monotonic Clock Scheduling: Calculate the execution interval of the time-series task based on the monotonic clock and trigger task scheduling. Specifically, record the monotonic clock timestamp and system clock timestamp of the task's last scheduled execution; calculate the task execution interval only based on the difference between the current monotonic clock timestamp and the monotonic clock timestamp of the last scheduled execution, and activate the task when the difference reaches the configured execution cycle.

[0026] Step S3, Time Jump Detection and Debouncing: Periodically detect the offset change between the system clock and the monotonic clock, and determine that a time jump event has occurred when the offset change reaches a set threshold.

[0027] Specifically, the current offset between the system clock and the monotonic clock is calculated, and the change in the current offset relative to the reference offset is also calculated. When the change exceeds a set threshold, a set-length observation window is entered; subsequent changes are accumulated within the observation window, and a merged time jump event is issued when the observation window ends and there is no reverse oscillation.

[0028] In some embodiments, transitions are categorized as follows based on their amplitude and direction:

[0029] To avoid the gradual adjustments during time synchronization being misinterpreted as multiple jumps, the following debouncing strategy is adopted: (1) After a jump occurs, an observation window period (default 5 seconds) is entered. New jumps detected during the window period are merged with the current jump. (2) Accumulate the jump amplitude during the observation period, and issue a single merged event after the window ends; (3) If the direction of the jump changes during the observation period (first backward and then forward), it is considered an oscillation, and a warning is recorded but no response is triggered.

[0030] Step S4, Omission Period Identification and Compensation Generation: In response to a time jump event, identify the omission task periods affected within the jump time window, and generate compensation tasks with theoretical trigger timestamps based on the omission task periods.

[0031] Specifically, the transition window is determined by the system clock time before and after the transition. The task configuration table is traversed and the execution cycle boundaries are aligned to identify any missed cycles within the transition window that have not been executed. A compensation context containing the theoretical trigger timestamp and compensation priority is constructed for each missed cycle, and the compensation context is injected into the scheduling queue.

[0032] In some embodiments, upon receiving a time jump event, the following determination process is executed: (1) Get the list of affected tasks: Iterate through all TaskConfig fields and filter out the valid tasks whose time ranges intersect with the jump window; (2) Calculate the jump window: jump_window_start = system clock time before jump, jump_window_end = system clock time after jump; (3) Determine the missing cycles: For each affected task, calculate the number of execution cycles that should have been triggered but were not triggered within the transition window; (4) Generate compensation context: Create a compensation context for each omission period, and record the theoretical trigger time, the actual omission reason, and the suggested compensation priority.

[0033] In some embodiments, different compensation strategies are employed based on the task type and jump category:

[0034] Step S5, Low-priority asynchronous supplementary execution: The compensation task is injected into the scheduling queue and executed asynchronously with a scheduling priority lower than that of normal periodic tasks. When executing the compensation task, the theoretical trigger timestamp is extracted from the compensation context as the timestamp source for generating frozen data, and the generated data to be written is associated with its corresponding theoretical trigger timestamp and stored in memory.

[0035] Furthermore, the solution in this embodiment also includes a data pre-writing verification and isolation step: before writing data to the memory, a monotonicity check (determining whether the timestamp is greater than the latest timestamp of the same data item already stored), a window check (determining whether the timestamp falls within a preset reasonable generation window), and a cross-check (determining whether the deviation between the system time and the timestamp exceeds the limit during scheduling) are performed. Data that fails the verification is marked as suspicious data and written to a preset suspicious data isolation area.

[0036] Specifically, the monotonicity check checks whether the timestamp of the frozen data to be written is greater than the latest frozen timestamp already stored for that data item. If it is less than or equal to the timestamp, it is determined to be a timestamp rollback, the write is rejected, and an alarm is triggered. Window validation: Checks whether the timestamp of the data to be written to the freeze falls within a reasonable generation window. For example, a reasonable window for daily freezing is 00:00-00:30 of the current day, and for monthly freezing, it is 00:00-00:30 of the 1st of the current month. Data outside the window is marked as suspicious. Cross-validation: The system clock recorded during task execution is compared with the timestamp of the frozen data. Data with a deviation exceeding the allowable range (default 5 minutes) is marked as suspicious.

[0037] In some embodiments, frozen data marked as suspicious is not written directly to the normal storage area, but is written to the suspicious data zone (Quarantine Zone) along with the following metadata: (1) Original timestamp, verification failure reason code, system clock during detection, and monotonic clock during detection; (2) Suspicious data retention period (default 7 days), during which manual review can be performed through the operation and maintenance interface; (3) If the review is approved, the data can be written into the normal storage area; if the review is not approved, the data will be deleted.

[0038] For confirmed duplicate frozen data (the same data item at the same time), a versioned storage strategy is adopted: 1) Instead of directly overwriting existing data, a new version is appended and marked with a version number; 2) The latest version is used by default when reporting and reading meters, but historical versions are retained for traceability; 3) Maximum number of versions (default 3). If this limit is exceeded, the oldest version will be automatically archived.

[0039] Furthermore, the present invention also includes a data protection mechanism for reported data.

[0040] Perform the following validations before data reporting: (1) Time Period Matching Verification: Verify whether the timestamps of each frozen time period in the reported data are consistent with the time period requirements configured in the reporting task. The daily frozen reporting task requires the data timestamp to be the previous natural day, and the monthly frozen reporting task requires the timestamp to be the previous natural month; (2) Integrity check: Verify whether all reported freeze periods are included. If any are missing, the reporting request is marked as incomplete; (3) Freshness check: Check whether the interval between the generation time and the reporting time of the reported data is reasonable. Data that exceeds the maximum allowed interval (default 2 hours) is marked as old.

[0041] Reported data that fails verification will be handled according to the following strategy: A. Time period mismatch: Reject reporting, record alarm, and wait for compensation task to regenerate data for the correct time period; B. Incomplete reporting: You can choose to report partial data (with missing data markers) or delay reporting and wait for it to be completed; C. Outdated data: Reported normally but marked as outdated. The main station will decide whether to adopt the data based on its policy after receiving it.

[0042] This embodiment also includes a continuous jump degradation processing step: counting the number of consecutive time jump events occurring within a set time period. When the number of consecutive events reaches a preset degradation threshold, a degradation mode is entered, the automatic generation of compensation tasks is paused, and data generated during this period is marked with a suspicious identifier.

[0043] In some embodiments, when multiple time jumps occur in a short period of time (e.g., within 1 hour), the system may enter an unstable state. Handling strategies: (1) Counter: consecutive_jump_count++ for each jump, and cleared to zero if there are no jumps in 24 hours; (2) Threshold alarm: warning logs are generated for two consecutive jumps, and alarms are triggered to notify the master station for three consecutive jumps; (3) Degradation mode: if there are more than three consecutive jumps, the system enters degradation mode, automatic compensation is suspended, all data is marked as suspicious, and manual intervention from the master station is required; (4) Automatic recovery: if there are no new jumps in 4 hours under degradation mode, the system will automatically recover to normal mode.

[0044] If the jump amplitude is very small but occurs frequently (e.g., 1ms adjustment per second), the handling strategy is: (1) Cumulative filtering: the event is only triggered when the cumulative jump amplitude exceeds the threshold; (2) NTP frequency adjustment: it is identified as normal NTP synchronization adjustment, the debugging log is recorded but compensation is not triggered.

[0045] The handling strategy for jump amplitude exceeding the reasonable range (such as more than 1 year) is as follows: (1) Reject processing: It is judged as a system failure and no compensation task is generated; (2) Data protection: All data to be written enters the suspicious area and waits for manual review; (3) Alarm reporting: The terminal abnormal event is immediately reported to the main station.

[0046] This embodiment also includes a data query response correction step: receiving an external data query request and parsing the target time period; if a time jump is detected within the target time period or within a set time range before it, and if it is a positive time jump, extending the start time of the query request time period forward to the time before the jump; and attaching a data quality annotation containing a timestamp verification status identifier, a credibility level, or a compensation data marker to the response message.

[0047] In addition, in this invention, when the compensation task causes a surge in data volume, the processing strategy is as follows: (1) Storage monitoring: real-time monitoring of storage space utilization; (2) Compensation flow limiting: when the space utilization exceeds 85%, non-urgent compensation tasks are suspended; (3) Automatic cleanup: suspicious data exceeding the retention period is automatically deleted.

[0048] Based on the above method, the present invention also provides a time synchronization protection device, such as... Figure 2 As shown, the device includes: Dual clock module: It is equipped with a monotonic clock that is unaffected by system time adjustment and a system clock for external communication; Scheduling module: Calculates the task execution interval based on the monotonic clock and triggers task scheduling; Jump detection module: used to periodically detect the offset change between the system clock and the monotonic clock, and determine the time jump event after the window period; Compensation scheduling module: used to calculate the missing period within the jump window based on the time jump event, generate a compensation task carrying the theoretical trigger timestamp, and inject it into the scheduling module with a priority lower than that of normal tasks; Data protection module: Used to verify the validity of data timestamps before data is written to storage, and to isolate and store data that fails verification.

[0049] Furthermore, the device is also equipped with a data query response module: used to receive external data query requests and parse the target time period, and when a time jump is detected, to extend the time period and add data quality annotations.

[0050] In the time synchronization protection device provided by this invention, the logical connection relationship between the data stream, control stream, and signal trigger is as follows: The output of the dual clock module is connected to the scheduling module and the transition detection module respectively. It is used to provide the scheduling module with a monotonic clock signal that is not affected by time synchronization, and to provide the transition detection module with real-time offset data between the system clock and the monotonic clock. The output of the time jump detection module is connected to the input of the compensation scheduling module, and is used to send a trigger signal to the compensation scheduling module when a time jump event is detected. The output of the compensation scheduling module is connected to the input of the scheduling module, and is used to inject the generated compensation tasks carrying theoretical trigger timestamps into the scheduling module with low priority. The data output of the scheduling module is connected to the input of the data protection module. The output of the data protection module is connected to the normal storage area and the suspicious data isolation area respectively, which are used to perform legality verification and diversion storage on the data generated by task execution. The input end of the data query response module is connected to the memory (including the normal storage area and the suspicious data isolation area), the control input end is connected to the recording unit of the jump detection module, and the data output end is connected to the external communication interface. It is used to perform time-period extension on external query requests based on jump records and output response messages with additional data quality annotations.

[0051] The solution of the present invention will now be described with reference to specific application examples.

[0052] Example 1 This embodiment is a specific application scenario example of the above method in the integrated terminal of the power marketing data collection system.

[0053] In the operation of a power grid site, the fusion terminal is deployed with daily freeze data collection tasks (execution cycle is 24 hours, configured to be triggered at 00:00 every day) and curve data collection tasks (execution cycle is 15 minutes).

[0054] 1. Time rewind to prevent the process from getting stuck: Assuming the current actual time is 10:30, the system clock suddenly reverts from 10:30 to 09:30 (reverting by 1 hour) due to a remote time synchronization error by the master station.

[0055] The drawback of the traditional method is that if the system clock is used, the last scheduling time is recorded as 10:30, and the current time changes back to 09:30. The difference between the current system time and the last scheduling time is -1 hour, which is less than the 15-minute execution cycle. As a result, the curve acquisition task will be directly stuck and suspended for 1 hour and 15 minutes.

[0056] The application process of this solution is as follows: The scheduling module calculates based on the monotonic clock in the dual-clock module. During the time synchronization period, the monotonic clock continuously and strictly increases monotonically (e.g., accumulating from the 36000th second after startup to the 36001st second), and the difference between the current monotonic clock timestamp and the timestamp of the monotonic clock at the time of the last scheduling execution reaches a 15-minute cycle. The curve acquisition task is triggered and activated normally at 10:45 corresponding to the monotonic clock, completely avoiding the 1-hour time rollback and ensuring the continuity of the scheduling logic.

[0057] 2. Automatic data recovery process for time jumps and day freezes: Assuming that the system clock jumps from 23:00 before the sudden change to 02:00 the next day (a jump of 3 hours forward) due to the recovery of the satellite lock-in the following day, it crosses the daily freeze trigger point of 00:00.

[0058] Jump Detection and De-jittering: The jump detection module detected an offset change of 3 hours, entering a 5-second observation window. No oscillation was detected at the end of the observation period, and a positive time jump event was issued.

[0059] Compensation Calculation: The compensation scheduling module calculates the jump window [23:00, 02:00] and identifies the missing daily freeze task that should have occurred at 00:00.

[0060] Theoretical timestamp restoration: The compensation scheduling module constructs a compensation context containing the theoretical trigger timestamp (00:00 of the current day) and injects the compensation task into the scheduling queue of the scheduling module. When the scheduling module executes the task, it extracts 00:00 as the frozen data timestamp and stores it in memory, thus repairing the previously missing daily frozen data chain.

[0061] Example 2 This embodiment demonstrates the collaborative application of concurrency control, traffic protection, and degradation mode in the above method under extreme failure scenarios.

[0062] Assuming the converged terminal is offline for an extended period, its clock experiences severe drift. When maintenance personnel perform time synchronization on-site, the system clock suddenly advances by 72 hours (spanning 3 daily freeze cycles and 288 curve acquisition cycles).

[0063] 1. Protection against data scraping storms (capacity reservation and priority control) If all 288 missed cycles are triggered to collect data simultaneously, the execution queue will be full and the serial communication of the electricity meter will be congested and crash.

[0064] In this embodiment, the compensation scheduling module filters and classifies 288 missed cycles: the 3 daily frozen missed cycles are marked as "urgent priority", and the curve acquisition is marked as "low priority".

[0065] The scheduling module divides the task queue into an 80% normal business area and a 20% compensation business area. Normal periodic data acquisition tasks occupying 80% of the capacity are prioritized for scheduling, while the three emergency day frozen compensation tasks are sequentially moved to the 20% capacity area for slow asynchronous execution. Curve data acquisition only reissues key nodes, discarding meaningless intermediate redundant points. Throughout the process, the system's CPU utilization and communication bus utilization remained stable, successfully mitigating the "data acquisition storm."

[0066] 2. Isolation of continuous jumps and abnormal data (degradation mode) If, within one hour, the time jump detection module detects three consecutive occurrences of a time jump event due to repeated time adjustments by on-site maintenance personnel (reaching the degradation threshold), then...

[0067] The system automatically switches to degradation mode, and the compensation scheduling module stops automatically generating compensation tasks to prevent frequent jumps from causing an infinite loop in the compensation logic. During this period, all collected data is forcibly written to a preset suspicious data quarantine zone and marked with a suspicious flag in the data metadata. After on-site investigation by maintenance personnel, they can manually review and confirm the data through the management interface with one click, and then batch-revert the quarantined data to normal.

[0068] Example 3 This embodiment demonstrates the specific application of the data protection and external query interface interception correction methods described above.

[0069] The main station sends a meter reading request message to the converged terminal to "query the electrical energy curve from 00:00 to 23:00 yesterday". It is known that the terminal experienced a time jump 30 minutes earlier at 14:00 yesterday.

[0070] 1. Time period correction for the corresponding data query module: The data query response module parses the target time period of the request [yesterday 00:00, yesterday 23:00] and detects that there are jump events within this time period.

[0071] The data query response module automatically extends the start time of the underlying data query by 30 minutes (i.e., starts the retrieval from 23:30 the day before yesterday) to ensure that the data at the edge of the jump window can be completely covered and retrieved, preventing the main site from missing tables.

[0072] 2. Data quality annotation injection in message response: When assembling the communication message returned to the master station (such as DL / T698.45 or State Grid 1376.2 protocol message), the data query response module adds a data quality annotation structure after the response data body, indicating the timestamp verification status, credibility level, and compensation data markup.

[0073] After receiving a message with this quality annotation, the master station can clearly know that the data segment has passed the terminal time synchronization protection verification and contains supplementary data. Therefore, it can reasonably assign weight to it in the big data analysis on the master station side to avoid falsely triggering line loss abnormal alarms.

[0074] The present invention also provides a terminal device. For example... Figure 2 As shown, the device includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the time synchronization protection method for converged terminals described above.

[0075] The device also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and will not be described in detail here.

[0076] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the time synchronization protection method for converged terminals described above.

[0077] While this specification has shown and described numerous embodiments of the invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in the practice of this invention.

Claims

1. A time synchronization protection method for fused terminals, characterized in that, include: Step S1: Configure an independently operating monotonic clock and system clock in the terminal device, wherein the monotonic clock is monotonically increasing and is not affected by system time calibration; Step S2: Calculate the execution interval of the timing task based on the monotonic clock and trigger task scheduling; Step S3: Periodically detect the offset change between the system clock and the monotonic clock, and determine that a time jump event has occurred when the offset change reaches a set threshold; Step S4: In response to the time jump event, determine the missing task cycles affected within the jump time window, and generate compensation tasks with theoretical trigger timestamps based on the missing task cycles. Step S5: Inject the compensation task into the scheduling queue, execute the compensation task asynchronously with a scheduling priority lower than that of normal periodic tasks, and store the generated data to be written in association with its corresponding theoretical trigger timestamp.

2. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, In step S2, calculating the execution interval of the timing task based on the monotonic clock and triggering task scheduling includes: Record the monotonic clock timestamp and system clock timestamp of the last scheduled execution of the task; The task execution interval is calculated based solely on the difference between the current monotonic clock timestamp and the monotonic clock timestamp at the time of the last scheduling execution. The task is activated when the difference reaches the configured execution cycle.

3. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, In step S3, the periodic detection of the offset change between the system clock and the monotonic clock includes: Calculate the current offset between the system clock and the monotonic clock at the current moment, and calculate the change of the current offset relative to the reference offset; When the change exceeds a set threshold, a set observation window period is entered; The subsequent changes are accumulated during the observation window, and a merged time jump event is issued when the observation window ends and there is no reverse oscillation.

4. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, In steps S4 and S5, the steps of generating and executing the compensation task include: Determine the transition window formed by the system clock time before the transition and the system clock time after the transition; Traverse the task configuration table, align execution cycle boundaries, and identify any missed cycles that were not executed within the transition window; A compensation context including a theoretical trigger timestamp and compensation priority is constructed for each missed period, and the compensation context is injected into the scheduling queue; When performing the compensation task, the theoretical trigger timestamp is extracted from the compensation context as the timestamp source for generating the frozen data.

5. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, The method also includes a verification and protection step before data is written, including: Monotonicity check: Determine whether the timestamp of the data to be written is greater than the latest timestamp of the same data item already stored; otherwise, refuse to write. Window validation: Determines whether the timestamp of the data to be written falls within a preset reasonable generation time window; Cross-validation: Compare the timestamp of the scheduling system clock recorded when the task is executed with the timestamp of the data to be written to determine whether the deviation exceeds the allowable range; When the data to be written fails the window verification or cross-verification, the data is marked as suspicious data and written to the preset suspicious data isolation area.

6. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, The method further includes a degradation processing step for consecutive jumps: Count the number of consecutive time jump events that occur within a set time period; When the number of consecutive occurrences reaches a preset degradation threshold, the system enters degradation mode, pauses the automatic generation of compensation tasks, and marks the data generated during this period with a suspicious identifier.

7. The time synchronization protection method for a converged terminal according to claim 1, characterized in that, The method also includes a data query request response correction step: Receive external data query requests and parse the target time period; If a time jump is detected within the target time period or within a predefined time range prior to it, the response is corrected according to the following rules: If a positive time jump occurs, the start time of the query request period will be extended backward to the time before the jump. The response message includes a data quality annotation, which includes at least one of a timestamp verification status identifier, a credibility level, or a compensation data tag.

8. A time synchronization protection device, characterized in that, include: Dual clock module: It is equipped with a monotonic clock that is unaffected by system time adjustment and a system clock for external communication; Scheduling module: Calculates the task execution interval based on the monotonic clock and triggers task scheduling; Jump detection module: used to periodically detect the offset change between the system clock and the monotonic clock, and determine time jump events; Compensation scheduling module: used to calculate the missing period within the jump window based on the time jump event, generate a compensation task carrying the theoretical trigger timestamp, and inject it into the scheduling module with a priority lower than that of normal tasks; Data protection module: used to verify the validity of data timestamps before data is written to storage, and to isolate and store data that fails verification.

9. A terminal device, comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the time synchronization protection method for a converged terminal as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the time synchronization protection method for a converged terminal as described in any one of claims 1 to 7.