CN115129647A - Time protection method and device based on time correction of time system card and storage medium - Google Patents
Time protection method and device based on time correction of time system card and storage medium Download PDFInfo
- Publication number
- CN115129647A CN115129647A CN202210506698.9A CN202210506698A CN115129647A CN 115129647 A CN115129647 A CN 115129647A CN 202210506698 A CN202210506698 A CN 202210506698A CN 115129647 A CN115129647 A CN 115129647A
- Authority
- CN
- China
- Prior art keywords
- time
- card
- alignment
- interrupt signal
- guard
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G04—HOROLOGY
- G04G—ELECTRONIC TIME-PIECES
- G04G7/00—Synchronisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0026—PCI express
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Electric Clocks (AREA)
Abstract
The invention discloses a time protection method, a device and a storage medium based on time keeping card time correction. Therefore, the invention can solve the problem that the equipment system time jumps caused by directly using the time counting card time to check the system time when the time counting card time jumps and the like.
Description
Technical Field
The invention relates to a system time correction technology, in particular to a time protection method, a device and a storage medium based on time correction of a time system card.
Background
The time system card is a plug-in product based on a computer bus (PCI Express), can receive time and interrupt signals input from the outside, provides high-precision synchronous time and frequency signals for devices such as a computer, a server and the like through the PCI-E bus, adopts a single-chip solution to realize a small-sized on-chip special system, and has high integration level and expandability.
For equipment for installing the time system card, the time system card is needed to be installed, the service monitors multicast information of a time server, after a time system signal sent by the time server through multicast is received, a time system thread is established to carry out time calibration, the time system card time is read by the time system card driving API for calling through the time system thread to carry out time calibration on the system time, and logs are recorded, the log time is the local time system card time obtained by the time system card driving API for calling, and once the time system card reading time is wrong, the time calibration time and the log time are wrong.
Disclosure of Invention
In view of the above problems, the present invention is directed to: the method comprises the steps of establishing guard time, updating the guard time by monitoring an interrupt signal, judging whether the time of the time keeping card jumps or is abnormal according to whether the guard time is consistent with the time of the time keeping card, and further determining whether the time of the time keeping card is allowed to be adopted to correct the system time so as to solve the problem that the system time of equipment jumps caused by directly correcting the system time by the time keeping card when the time of the time keeping card jumps and the like.
In order to achieve the purpose, the invention provides the following technical scheme:
a time protection method based on time correction of a time system card comprises the following steps:
after the timing service is started, continuously monitoring an interrupt signal periodically output by a timing system card;
when the first interrupt signal is output by the time master card, the current time of the time master card is used as the initial value of the guard time; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one time at the current guard time so as to update the guard time;
and, continuously monitoring a timing signal sent by the time server through multicast; and after receiving the timing signal, judging whether the current time of the timing service card is consistent with the guard time, if so, allowing the time of the timing service card to be used to correct the system time, otherwise, rejecting the time of the timing service card to correct the system time, and recording a log and reporting an alarm.
According to a specific implementation mode, in the time protection method based on time alignment of the time alignment card, when the interrupt signals periodically output by the time alignment card are continuously monitored, whether the time difference of the time alignment card corresponding to two continuous interrupt signals is equal to the cycle time is also judged; if not, recording the log and reporting an alarm.
According to a specific implementation mode, in the time protection method based on time alignment of the time alignment card, whether an external clock source is input into the time alignment card is judged by reading the flag bit of the register of the time alignment card; if no external clock source is input, the log is recorded and an alarm is reported.
In another aspect of the present invention, a time protection device based on time-based card timing is further provided, which includes:
the interrupt signal monitoring module is used for continuously monitoring the interrupt signals periodically output by the time system card after the time correction service is started;
the guard time management module is used for taking the current time of the time counting card as the initial value of the guard time when the time counting card outputs the first interrupt signal when monitoring; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one at the current guard time so as to update the guard time;
the time-correcting signal monitoring module is used for continuously monitoring the time-correcting signal sent by the time server through multicast;
the time correction management module is used for judging whether the current time of the time correction card is consistent with the guard time or not after receiving the time correction signal, if so, allowing the time of the time correction service time correction card to correct the system time, otherwise, refusing the time of the time correction service time correction card to correct the system time;
and the early warning module is used for recording logs and reporting an alarm when the current time of the system card is inconsistent with the guard time.
According to a specific implementation manner, the time protection device based on time alignment of the time alignment card further comprises a period time judgment module, which is used for judging whether the time difference of the time alignment card corresponding to two continuous interrupt signals is equal to the period time or not; and the early warning module is used for recording logs and reporting an alarm when the time difference of the system card corresponding to two continuous interrupt signals is not equal to the cycle time.
According to a specific implementation manner, the time protection device based on time alignment of the time alignment card further comprises an external time source input monitoring module, which is used for reading a flag bit of a time alignment register to judge whether the time alignment card has external clock source input or not when judging whether the time difference of the time alignment card corresponding to two continuous interrupt signals is equal to the cycle time or not; and the early warning module is used for recording logs and reporting an alarm when the time system card has no external clock source input.
In another aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium on which one or more programs are stored, the one or more programs, when executed by one or more processors, implementing the time protection method based on time-tick of the present invention.
Compared with the prior art, the invention has the beneficial effects that:
the time protection method based on time keeping card time correction updates guard time by establishing guard time and monitoring an interrupt signal, judges whether the time keeping card time jumps or is abnormal according to whether the guard time is consistent with the time keeping card time, and further determines whether the time keeping card time is allowed to be adopted to correct the system time. Therefore, the invention can solve the problem that the system time of the equipment jumps caused by directly using the time of the time-sharing card to correct the system time when the time of the time-sharing card jumps and the like.
Drawings
FIG. 1 is a schematic flow chart of a time correction service of a time system card;
FIG. 2 is a diagram illustrating a daemon time management process;
FIG. 3 is a schematic flow chart of timing management;
FIG. 4 is a functional block diagram of the apparatus of the present invention.
Detailed Description
The invention is described in further detail below with reference to the figures and the embodiments. It should be understood that the scope of the above-described subject matter is not limited to the following examples, and any techniques implemented based on the disclosure of the present invention are within the scope of the present invention.
For the equipment of the time-sharing card, the time-sharing service is installed, the service monitors multicast information of a time server, after a time-sharing signal sent by the time server through multicast is received, a time-sharing thread is established for time sharing, the time-sharing process is shown in figure 1, the time-sharing machine room equipment outputs a B code signal and sends the B code signal to a time-sharing terminal and the time server, the time-sharing terminal accesses the B code, decodes and displays the B code according to a set mode and distributes the time-sharing card of the server, the network time service of the time server sends time-sharing commands to all servers through a network at regular time, the time-sharing service on the server receives the time-sharing commands and judges whether the time of the time-sharing card jumps or not, if the time jumps, the alarm is not, and if the time jumps, the time-sharing card time is obtained through the time-sharing card drive to correct the local time.
The time protection method based on time correction of the time statistic card comprises the following steps:
after the timing service is started, continuously monitoring an interrupt signal periodically output by a timing system card;
when the first interrupt signal is output by the time master card, the current time of the time master card is used as the initial value of the guard time; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one time at the current guard time so as to update the guard time;
and, continuously monitoring a timing signal sent by the time server through multicast; and after receiving the timing signal, judging whether the current time of the timing service card is consistent with the guard time, if so, allowing the time of the timing service card to be used to correct the system time, otherwise, rejecting the time of the timing service card to correct the system time, and recording a log and reporting an alarm.
Specifically, as shown in fig. 2, for the thread 1 for managing the daemon time, taking a 1Hz interrupt signal output by the time master card as an example, after the thread 1 monitors the first 1Hz interrupt signal of the time master card, the current time master time T0 is obtained as an initial value of the daemon time Currenttime, the current time is T0, after each 1Hz interrupt signal is received, the daemon time Currenttime is added by 1, and at the time of calibration, the time master time is compared with the daemon time Currenttime to determine whether to calibrate. In the concrete code implementation, when a thread 1 acquires the first interrupt of a time system card, acquiring the current time system card time getAbsTime (& actuation), recording as start _ time, creating a counter variable changSecondes as the initial value of guard time, automatically adding 1 to the changSecondes every time a 1Hz interrupt signal is received, wherein the guard time in the step is the sum of the initial value of the guard time start _ time and the counter variable changSecondes, the guard time variable is not directly set in a program for the simplicity of program implementation, and the start _ time and the changSecondes are directly used for comparison and calculation in subsequent time comparison.
Meanwhile, in the time protection method based on time alignment of the time alignment card, when the interrupt signals periodically output by the time alignment card are continuously monitored, whether the time difference of the time alignment card corresponding to two continuous interrupt signals is equal to the cycle time or not is also judged; if not, recording the log and reporting an alarm. Specifically, in the implementation, in the thread 1, each time a 1Hz interrupt signal is received, the system card time getAbsTime (& abstime) is obtained and assigned to time (absolute second), which is 2sec (system.year, system.month, system.day, system.home, system.minimum, system.second), and the system card time obtained by the last interrupt signal is assigned to last system card time, which is time. Thus, whether the time difference between the two times is 1 second (the period time corresponding to the 1Hz interrupt signal is 1 second) is judged, if the difference between the two times is not equal to 1, a log is recorded, and an alarm is reported.
Specifically, as shown in fig. 3, for thread 2 used for timing management, the time alignment service monitors multicast information of the time server, and creates thread 2 for timing after receiving a timing signal sent by the time server through multicast; when the thread 2 waits until the first 1Hz interrupt signal, the current system card time getABsTime (& abstime) is obtained, the absolute second sec is taken as time2sec (abstim. year, abstim. month, abstim. day, abstim. home, abstim. minimum, abstim. second), the difference between the time and the guard time initial value start _ time in the first step is used to judge whether the difference value is equal to the current counter variable value, comparing the time with the guard time, if the difference between the current time and the initial value of the guard time is equal to the variable value of the counter, that is, the guard time is matched with the current time system card time, the time system card time is used for timing the system time and recording the log, the start _ time, the change _ seconds and the if _ change _ ret are respectively set, if the two are not matched, only the log is recorded and the alarm is reported if the two are not matched, therefore, the system time is prevented from jumping due to direct proofreading of the system time after the time of the time system card jumps.
In addition, in the execution process of the thread 1 for guard time management and the thread 2 for timing management, the execution condition and the abnormal condition which may occur are judged and recorded, and the abnormal condition is uploaded to the operation and maintenance platform by using an HTTP (hyper text transport protocol) through an interface provided by the operation and maintenance platform.
In the time protection method based on time master card timing, if no external time source input exists, the time master card can be self-held for a period of time and then slowly drifted, whether the external time source input exists in the time master card is monitored so as to ensure that the time master card always has the external time source input, if no external input generates an alarm, human intervention is performed in time, and if the external time source input does not exist in time, the time master card can drift after a period of time. Therefore, whether the time difference of the time system cards corresponding to two continuous interrupt signals is equal to the cycle time or not is judged, so that whether the time system card time used for time calibration of the system time by the time calibration service jumps or not is judged, whether the time system card time moves within one second or not is monitored, the time system card time possibly comes from external time source input of the time system card, and the self-defense time of the time system card is realized if no external time source input exists.
Therefore, when judging whether the time difference of the system card corresponding to two continuous interrupt signals is equal to the cycle time, judging whether the system card has an external clock source input by reading the flag bit of the register of the system card; if no external clock source is input, the log is recorded and an alarm is reported. In implementation, the thread 1 monitoring content for daemon time management includes: and if the time difference of the two continuous interrupts is not 1 or no external clock source is input into the time system card, calling a log function to record a log and reporting to the operation and maintenance platform.
During implementation, the thread 2 monitoring content for timing management includes whether timing is successful or not, whether timing interruption is normal or not, whether a timing service calling drive interface is normal or not, if timing is successful, only logs are recorded, and if timing is stopped or timing interruption is abnormal or the timing service calling drive interface fails, the logs are recorded and reported to the operation and maintenance alarm system. When an alarm occurs, the problem can be manually checked through the log in time, and corresponding measures are taken to prevent the problems of system time drift and the like caused by long-time timing stop.
As shown in fig. 4, the present invention further provides a time protection device based on time calibration of a time master card, which includes:
the interrupt signal monitoring module is used for continuously monitoring the interrupt signals periodically output by the time system card after the time correction service is started;
the guard time management module is used for taking the current time of the time counting card as the initial value of the guard time when the time counting card outputs the first interrupt signal when monitoring; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one at the current guard time so as to update the guard time;
the time-correcting signal monitoring module is used for continuously monitoring the time-correcting signal sent by the time server through multicast;
the time correction management module is used for judging whether the current time of the time correction card is consistent with the guard time or not after receiving the time correction signal, if so, allowing the time of the time correction service time correction card to correct the system time, otherwise, refusing the time of the time correction service time correction card to correct the system time;
and the early warning module is used for recording logs and reporting an alarm when the current time of the system card is inconsistent with the guard time.
Specifically, the time protection device based on time alignment of the time alignment card further comprises a cycle time judgment module, which is used for judging whether the time difference between the time alignment cards corresponding to two continuous interrupt signals is equal to the cycle time; and the early warning module is used for recording logs and reporting an alarm when the time difference of the system card corresponding to two continuous interrupt signals is not equal to the cycle time.
Further, the time protection device based on time alignment of the time alignment card of the invention further comprises an external time source input monitoring module, which is used for reading the flag bit of the time alignment register to judge whether the time alignment card has an external clock source input when judging whether the time difference of the time alignment card corresponding to two continuous interrupt signals is equal to the cycle time; and the early warning module is used for recording logs and reporting an alarm when the time system card has no external clock source input.
In another aspect of an embodiment of the present invention, there is also provided a computer-readable storage medium on which one or more programs are stored, the one or more programs, when executed by one or more processors, implementing the time protection method based on time-tick of the present invention.
It should be understood that the disclosed system may be implemented in other ways. For example, the division of the modules into only one logical functional division may be implemented in practice in other ways, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the communication connection between the modules may be an indirect coupling or communication connection through some interfaces, devices or units, and may be electrical or in other forms.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above description is intended to be illustrative of the preferred embodiment of the present invention and should not be taken as limiting the invention, but rather, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention.
Claims (7)
1. A time protection method based on time correction of a time system card is characterized by comprising the following steps:
after the timing service is started, continuously monitoring an interrupt signal periodically output by the time measuring card;
when the first interrupt signal is output by the time master card, the current time of the time master card is used as the initial value of the guard time; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one at the current guard time so as to update the guard time;
and, continuously monitoring a timing signal sent by the time server through multicast; and after receiving the timing signal, judging whether the current time of the timing service card is consistent with the guard time, if so, allowing the time of the timing service card to be used to correct the system time, otherwise, rejecting the time of the timing service card to correct the system time, and recording a log and reporting an alarm.
2. The time protection method based on time alignment of the time alignment card according to claim 1, wherein when the interrupt signals periodically output by the time alignment card are continuously monitored, it is further determined whether the time difference between the time alignment cards corresponding to two consecutive interrupt signals is equal to the cycle time; if not, recording the log and reporting an alarm.
3. The time protection method based on time alignment of the time alignment card according to claim 2, wherein when judging whether the time difference between the time alignment cards corresponding to two continuous interrupt signals is equal to the cycle time, judging whether the time alignment card has an external clock source input by reading the flag bit of the register of the time alignment card; if no external clock source is input, the log is recorded and an alarm is reported.
4. A time protection device based on time correction of a time system card is characterized by comprising:
the interrupt signal monitoring module is used for continuously monitoring the interrupt signals periodically output by the time system card after the time correction service is started;
the guard time management module is used for taking the current time of the time counting card as the initial value of the guard time when the time counting card outputs the first interrupt signal when monitoring; after the first interrupt signal is monitored, when the system card outputs the interrupt signal when the first interrupt signal is monitored, the cycle time of outputting the interrupt signal by the system card is increased by one at the current guard time so as to update the guard time;
the time-correcting signal monitoring module is used for continuously monitoring the time-correcting signal sent by the time server through multicast;
the time correction management module is used for judging whether the current time of the time correction card is consistent with the guard time or not after receiving the time correction signal, if so, allowing the time of the time correction service time correction card to correct the system time, otherwise, refusing the time of the time correction service time correction card to correct the system time;
and the early warning module is used for recording logs and reporting an alarm when the current time of the system card is inconsistent with the guard time.
5. The time protection device for time calibration based on the time master card of claim 4, further comprising a period time judgment module for judging whether the time difference between the time master cards corresponding to two consecutive interrupt signals is equal to the period time; and the early warning module is used for recording logs and reporting an alarm when the time difference of the system card corresponding to two continuous interrupt signals is not equal to the cycle time.
6. The time protection device for time calibration based on a time alignment card according to claim 5, further comprising an external time source input monitoring module, configured to, when determining whether the time difference between the time alignment cards corresponding to two consecutive interrupt signals is equal to the cycle time, determine whether the time alignment card has an external clock source input by reading a flag bit of a register of the time alignment card; and the early warning module is used for recording logs and reporting an alarm when the time system card has no external clock source input.
7. A computer readable storage medium having one or more programs stored thereon, wherein the one or more programs, when executed by one or more processors, implement the time protection method based on time-tick of any of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210506698.9A CN115129647A (en) | 2022-05-07 | 2022-05-07 | Time protection method and device based on time correction of time system card and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210506698.9A CN115129647A (en) | 2022-05-07 | 2022-05-07 | Time protection method and device based on time correction of time system card and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115129647A true CN115129647A (en) | 2022-09-30 |
Family
ID=83377036
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210506698.9A Pending CN115129647A (en) | 2022-05-07 | 2022-05-07 | Time protection method and device based on time correction of time system card and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115129647A (en) |
-
2022
- 2022-05-07 CN CN202210506698.9A patent/CN115129647A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109739727B (en) | Service monitoring method and device in micro-service architecture | |
EP3121726B1 (en) | Fault processing method, related device and computer | |
CN114499732B (en) | Clock calibration method, clock calibration device, computer equipment and readable storage medium | |
US20130212436A1 (en) | Method and system for detecting abnormality of network processor | |
CN106294040B (en) | Method and device for acquiring optical module state information | |
EP2626790A1 (en) | Fault monitoring device, fault monitoring method and program | |
EP2902940B1 (en) | Storage system and method for processing data operation request | |
US11853150B2 (en) | Method and device for detecting memory downgrade error | |
KR20080058454A (en) | A distributed monitoring method | |
US20210410255A1 (en) | Lighting control method, system and device for nvme backboard, and medium | |
CN111210864A (en) | DDR chip testing method, device, equipment and computer readable storage medium | |
CN111130951B (en) | Equipment state detection method, device and storage medium | |
CA2920109A1 (en) | Rootkit detection in a computer network | |
CN108932007B (en) | Method for acquiring time stamp and computer device | |
FI91108C (en) | Multiprocessor system controller | |
CN115129647A (en) | Time protection method and device based on time correction of time system card and storage medium | |
EP4050822A1 (en) | Method for locating clock fault and network apparatus | |
CN108737184B (en) | Management method and device of disaster recovery system | |
US11188116B2 (en) | Hard disk monitoring system and monitoring method using complex programmable logic device | |
CN106375354B (en) | Data processing method and device | |
US20240103563A1 (en) | System and method for time synchronization between multiple operating systems | |
CN114721249B (en) | Microsecond level singlechip timing device and method | |
CN112699015B (en) | Log output method, device, server and computer readable storage medium | |
CN115129508A (en) | Out-of-band processing method, device, equipment and medium for correcting errors of memory | |
CN118034993A (en) | Method and device for protecting stored data, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |