Networking device, clock exception processing method and device, equipment and storage medium

By determining the initial abnormal state of the RTC in the networking device and comparing and calibrating the time with multiple devices, the problem of inaccurate system time of the networking device is solved, and higher time determination accuracy and resource conservation are achieved.

CN115622653BActive Publication Date: 2025-10-21HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211257390.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2025-10-21
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

In the prior art, there is inaccuracy in determining the system time of networking devices. In particular, when the real-time clock chip (RTC) is abnormal, the system time cannot be accurately determined.

Method used

The system determines the initial abnormal state of the real-time clock chip RTC in the networking device. If there is no abnormality, it compares the calibration time with multiple communication-connected networking devices, calculates the time deviation, and determines the system time based on the deviation result.

Benefits of technology

Improves the accuracy of system time on networking devices, reduces system time errors caused by RTC anomalies, saves resource consumption, and reduces random errors through calibration of multiple devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115622653B_ABST
    Figure CN115622653B_ABST
Patent Text Reader

Abstract

The application discloses a networking device, a clock exception processing method and device, equipment and a storage medium. The method comprises the following steps: performing initial determination on whether the state of a real-time clock chip (RTC) in a first networking device is abnormal; if the state of the RTC is not abnormal, comparing a first time recorded by the RTC and calibration time determined by a plurality of second networking devices which are in communication connection with the first networking device, to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at a current time, and the calibration time is calculated based on a second system time recorded by each second networking device at the current time; and determining the system time of the first networking device as the first time or the calibration time according to the comparison result of the first time deviation and a preset deviation. The application can accurately determine the system time of the first networking device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication computer technology, and in particular to a networking device, a clock anomaly processing method, an apparatus, a device, and a storage medium. Background Art

[0002] Currently, network video recorders (NVRs) and other networking devices are equipped with real-time clock chips. These chips are integrated circuit modules with independent batteries and crystal oscillators that can run continuously and provide time for networking devices.

[0003] When a networking device such as an NVR is turned on, the system time needs to be determined. In the prior art, if it is determined that there is no abnormality in the RTC, the RTC reading time is used as the system time of the network video recorder. This situation causes the system time of the network video recorder to be incorrectly determined.

[0004] That is, there is a technical problem in the prior art that it is difficult to accurately determine the system time of the networking device. Summary of the Invention

[0005] In view of this, embodiments of the present application provide a clock anomaly processing method, apparatus, device, and storage medium, which aim to accurately determine the system time of networking devices such as network video recorders.

[0006] The present invention provides a method for handling clock anomalies, which is applied to a first networking device. The method includes:

[0007] Initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal;

[0008] If the state of the RTC is not abnormal, comparing the first time recorded by the RTC with calibration times determined by multiple second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment;

[0009] According to a comparison result between the first time deviation and a preset deviation, the system time of the first networking device is determined as the first time or the calibration time.

[0010] In a possible implementation of the present application, before the step of comparing the first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time offset, the method includes:

[0011] Classifying the second target networking devices whose second time deviations are within the first preset duration into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, determining the second time deviation as the difference between the second system times corresponding to the largest time span after sorting, and the largest time span is less than the first preset duration;

[0012] wherein, determining a second networking device corresponding to a second system time within the maximum time span as a second target networking device;

[0013] A target group with the largest number of devices is determined from the classified second target networking device groups, and an average value of the second system time recorded by each second target networking device in the target group is used as the calibration time.

[0014] In a possible implementation manner of the present application, the step of determining the system time of the first networking device as the first time or the calibration time based on a comparison result of the first time deviation and a preset deviation includes:

[0015] Determining whether the multiple second system times recorded by the multiple second networking devices are consistent based on a comparison result of the first time deviation and a preset deviation;

[0016] If they are consistent, determining the system time of the first networking device as the calibration time;

[0017] If there is no consistency, the system time of the first networking device is determined as the first time.

[0018] In a possible implementation manner of the present application, the step of determining whether the multiple second system times recorded by the multiple second networking devices are consistent based on a comparison result of the first time deviation and the preset deviation includes:

[0019] If the first time deviation is greater than a preset deviation, determining the level of the calibration time;

[0020] If the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent;

[0021] If the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent;

[0022] Among them, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above the preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level.

[0023] In a possible implementation manner of the present application, the step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal includes:

[0024] If at least one of the following conditions exists, it is determined that the state of the real-time clock chip RTC in the first networking device is abnormal:

[0025] The RTC reading interface reports an error;

[0026] The RTC reading is 0;

[0027] There are abnormal values ​​in the time field of the RTC reading;

[0028] A deviation between a first time variation recorded by the RTC after a second preset time period and a second system time variation recorded by the second networking device after the second preset time period is not within a preset time difference range.

[0029] In a possible implementation manner of the present application, the step of initially determining whether the status of the real-time clock chip RTC in the first networking device is abnormal further includes:

[0030] Determine whether the RTC reading interface reports an error;

[0031] If no error is reported, determining whether the RTC reading is 0;

[0032] If it is not 0, determining whether there is an abnormal value in the time field of the RTC reading;

[0033] If no abnormal value exists, determining whether a deviation between the first time variation recorded by the RTC after the second preset time period and the second system time variation recorded by the second networking device after the second preset time period is within a preset time difference range;

[0034] If it is within the preset time difference range, it is determined that the state of the RTC is not abnormal.

[0035] The present application also provides a device clock abnormality processing device, the device comprising:

[0036] The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal;

[0037] a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment;

[0038] A time arbitration module is configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result between the first time deviation and a preset deviation.

[0039] In a possible embodiment of the present application, the device includes: the device also includes: a classification module, used to classify the second target networking devices whose second time deviation is within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than the first preset time length; wherein, the second networking device corresponding to the second system time between the maximum time spans is determined as the second target networking device; a determination module, used to determine the target group with the largest number from the classified second target networking device group, and use the average value of the second system time recorded by each second target networking device in the target group as the calibration time;

[0040] And / or, the time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; and a third determining unit is configured to, if they are not consistent, determine the system time of the first networking device as the first time;

[0041] And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level;

[0042] And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range;

[0043] And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

[0044] The present application further provides a networking device, the networking device being a first networking device, wherein a real-time clock chip RTC is provided in the first networking device, an independent battery and a crystal oscillator are provided in the RTC, and the RTC provides system time for the first networking device based on the independent battery and the crystal oscillator, the first networking device is communicatively connected to a plurality of second networking devices, and the first networking device further comprises:

[0045] The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal;

[0046] a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment;

[0047] A time arbitration module is configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result between the first time deviation and a preset deviation.

[0048] In a possible implementation manner of the present application, the networking device further includes:

[0049] A classification module is used to classify the second target networking devices whose second time deviations are within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than the first preset time length; wherein the second networking device corresponding to the second system time between the maximum time spans is determined as the second target networking device; a determination module is used to determine the target group with the largest number from the classified second target networking device groups, and use the average value of the second system time recorded by each second target networking device in the target group as the calibration time;

[0050] And / or, the time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; and a third determining unit is configured to, if they are not consistent, determine the system time of the first networking device as the first time;

[0051] And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level;

[0052] And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range;

[0053] And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

[0054] In a possible implementation of the present application, an RTC is provided in both the first networking device and the second networking device. After the first networking device passes the authentication of the second networking device based on a preset communication protocol, the first networking device performs signaling interaction with the second networking device to obtain the second system time of the second networking device.

[0055] The present application also provides a device clock exception processing device, which is a physical node device. The device clock exception processing device includes: a memory, a processor, and a program of the clock exception processing method stored on the memory and capable of running on the processor. When the program of the clock exception processing method is executed by the processor, the steps of the clock exception processing method as described above can be implemented.

[0056] To achieve the above object, a storage medium is further provided, on which a device clock exception handling program is stored. When the device clock exception handling program is executed by a processor, the steps of any of the above-mentioned clock exception handling methods are implemented.

[0057] The present application provides a networking device, a clock exception processing method, an apparatus, a device and a storage medium. Compared with the prior art in which the system time of the networking device cannot be accurately determined, in the present application, an initial determination is made as to whether the status of a real-time clock chip RTC in a first networking device is abnormal; if the status of the RTC is not abnormal, the first time recorded by the RTC is compared with the calibration time determined by multiple second networking devices that are communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment; based on the comparison result of the first time deviation and the preset deviation, the system time of the first networking device is determined as the first time or the calibration time. In the present application, the situation in which the system time cannot be accurately determined due to inaccurate identification of whether the RTC is abnormal is avoided. Instead, when it is determined that the RTC is normal, the first time recorded by the RTC is further compared with the calibration time determined by multiple second networking devices to obtain a first time deviation (the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment). Then, based on the first time deviation, the system time of the networking device is determined. Since the further determination not only considers whether the first time recorded by the RTC is abnormal, but also comprehensively considers the calibration time determined by multiple second networking devices (which can reduce the error of randomly selecting the time of a single second networking device), the system time can be determined more accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 This is a flowchart of the first embodiment of the clock abnormality processing method of the present application;

[0059] Figure 2 This is a detailed flow chart before step S10 in the first embodiment of the clock anomaly processing method of the present application;

[0060] Figure 3 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application;

[0061] Figure 4 This is a flowchart of the RTC anomaly detection process involved in the device clock anomaly processing method of this application;

[0062] Figure 5 A schematic diagram of a flow chart for determining the level of calibration time involved in the clock anomaly handling method of the present application;

[0063] Figure 6A schematic diagram of a scenario for classifying the second network device involved in the clock anomaly handling method of this application;

[0064] Figure 7 This is a schematic diagram of the overall process involved in the clock anomaly handling method of this application. DETAILED DESCRIPTION

[0065] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0066] The present application embodiment provides a clock abnormality processing method. In one embodiment of the clock abnormality processing method of the present application, refer to Figure 1 , applied to a first networking device, the method comprising:

[0067] Step S10, initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal;

[0068] Step S20: If the state of the RTC is normal, comparing the first time recorded by the RTC with the calibration time determined by multiple second networking devices in communication with the first networking device to obtain a first time offset, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment;

[0069] Step S30: According to a comparison result between the first time deviation and a preset deviation, the system time of the first networking device is determined as the first time or the calibration time.

[0070] This embodiment aims to accurately determine the system time of the first networking device.

[0071] The background involved in this embodiment is:

[0072] When the first networking device such as the NVR is turned on, the system time needs to be determined. If it is determined that the RTC is normal, the RTC reading time is used as the system time of the first networking device. However, the current method for determining whether the RTC is abnormal is: use the local configuration file of the first networking device to record the time. Specifically, if the new startup time of the first networking device is not later than the time recorded in the previous configuration file, it is determined that the RTC is normal. If the RTC reading is a random time or the reading is slower than the real time (but not later than the time recorded in the previous configuration file), the RTC reading time is still used as the system time or the calibration time is obtained at any time. This situation leads to the incorrect determination of the system time of the first networking device.

[0073] Specifically, in the present application, the situation in which the system time cannot be accurately determined due to inaccurate identification of whether the RTC is abnormal is avoided. Instead, when it is initially determined that the RTC is normal, the first time recorded by the RTC is further compared with the calibration time determined by multiple second networking devices (the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment) to obtain a first time deviation. Then, based on the first time deviation, the system time of the networking device is determined. Since the further determination not only initially considers whether the first time recorded by the RTC is abnormal, but also comprehensively considers the calibration time determined by multiple second networking devices (and can reduce the error of randomly selecting the time of a single second networking device), the system time can be determined more accurately.

[0074] Furthermore, in the present application, there is no need to frequently write configuration files in the networking devices, and there is no need to rely on persistent storage media such as flash due to frequent writing of configuration files, thereby saving resources.

[0075] Furthermore, in the present application, since the configuration file is not written frequently, the life span of persistent media such as flash will not be affected.

[0076] Furthermore, in the present application, for the situation where the RTC reading is a random time or the reading is slower than the real time (but not later than the time recorded in the previous configuration file), the present application comprehensively considers the calibration time determined by multiple second network devices, and therefore, can accurately identify the situation where the RTC is running but very slowly due to intermittent oscillation stoppage, inaccurate crystal oscillator, etc.

[0077] Furthermore, in the present application, the second networking devices whose second time deviation is within the first preset time length are classified into one category, and the target group with the largest number is determined from the classified second target networking device groups, and the average value of the second system time recorded by each second target networking device in the target group is used as the calibration time. Since in the present application, the selected target group is the one with the largest number of second networking devices in the corresponding time interval (the second networking device with the closest time, the time credibility is high), and the corresponding average value of the second system time recorded by the largest number of second networking devices is used as the calibration time, based on this, the error of randomly selecting the time of a single second networking device is reduced with maximum probability, thereby accurately determining or ensuring the validity of the calibration time.

[0078] Furthermore, in the present application, it is also determined whether the second system time is consistent. If it is consistent, the system time of the first networking device is determined as the calibration time. That is, if the second system time is consistent, it indicates that the corresponding calibration time is a reliable time, and thus, the system time of the first networking device is accurately determined.

[0079] Furthermore, in the present application, the level of the calibration time is also determined, so as to accurately determine whether the second system time is consistent. If the level of the calibration time is the first level (if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is within a preset ratio), the calibration time is used as the system time; because when the second networking device time of the target group is highly similar (the level is the first level), the average value of the second system time of the target group can be used as a high-reliability time, which can solve the current situation where the RTC time is a random value but cannot be identified, thereby improving the accuracy of determining the system time.

[0080] Furthermore, in the present application, an initial determination is made accurately as to whether the state of the real-time clock chip RTC in the first networking device is abnormal, thereby providing a basis for accurately determining the system time.

[0081] Furthermore, in the present application, if the first time deviation is less than or equal to a preset deviation, then the RTC time is relatively accurate, and then the first time is determined as the system time of the first networking device.

[0082] Furthermore, in the present application, if the state of the RTC is abnormal, the calibration time is used as the system time to accurately determine the system time of the first networking device.

[0083] In this embodiment, it should be noted that:

[0084] The clock exception handling method is applied to a first networking device. Both the first networking device and the second networking device may be provided with an RTC. After the first networking device passes the authentication of the second networking device based on a preset communication protocol, the first networking device performs signaling interaction with the second networking device to obtain the second system time of the second networking device.

[0085] That is, in this embodiment, the first networking device needs to use the system time of the second networking device to correct its own system time.

[0086] In this embodiment, in order for the first networking device to use the system time of the second networking device to correct its own system time, the first networking device and the second networking device need to be in communication connection with each other.

[0087] As an example, the first networking device and the second networking device are in mutual communication connection, which is reflected in: 1. There is a set of mutually recognized protocols between the first networking device and the second networking device, such as the ONVIF standard protocol; 2. The first networking device and the second networking device can be authenticated (the first networking device can obtain the password and other information of the second networking device); 3. The first networking device can obtain time from the second networking device (both of which are equipped with RTC clocks) (with a protocol that supports time acquisition).

[0088] As an example, the first networking device may be a network video recorder (NVR).

[0089] As an example, when the first networking device is a network video recorder NVR (Network video recorder), the second networking device can be a network camera IPC (IP Camera), or when the first networking device is a network video recorder NVR, the second networking device can be an NVR cluster composed of other network video recorders NVR (Network video recorder), or when the first networking device is a network video recorder NVR, the second networking device can be a device cluster composed of NVR + digital video recorder DVR (Digital Video Recorder).

[0090] As an example, a real-time clock chip RTC is provided in the first networking device, and an independent battery and a crystal oscillator are provided in the RTC. The RTC provides system time for the first networking device based on the independent battery and crystal. The first networking device is communicatively connected to multiple second networking devices. The first networking device also includes: an RTC abnormality checking module, which is used to initially determine whether the state of the real-time clock chip RTC is abnormal; a calibration time determination module, which is used to compare the first time recorded by the RTC with the calibration time determined by multiple second networking devices communicatively connected to the first networking device if the state of the RTC is not abnormal, to obtain a first time deviation, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment; a time arbitration module, which is used to determine the system time of the first networking device as the first time or the calibration time according to the comparison result of the first time deviation and the preset deviation.

[0091] As an example, the RTC anomaly check module, calibration time determination module and time arbitration module are all logic modules, which are corresponding software algorithm program segments. Specifically, the RTC anomaly check module, calibration time determination module and time arbitration module are set in the processor of the first networking device and implement the corresponding algorithm functions.

[0092] As an example, the networking device further includes:

[0093] A classification module is used to classify the second target networking devices whose second time deviations are within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than the first preset time length; wherein the second networking device corresponding to the second system time between the maximum time spans is determined as the second target networking device; a determination module is used to determine the target group with the largest number from the classified second target networking device groups, and use the average value of the second system time recorded by each second target networking device in the target group as the calibration time;

[0094] And / or, the time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; and a third determining unit is configured to, if they are not consistent, determine the system time of the first networking device as the first time;

[0095] And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level;

[0096] And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range;

[0097] And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

[0098] As an example, in this application, a specific description is given by taking the case where the first networking device is a network video recorder NVR (Network Video Recorder) and the second networking device is an IP Camera IPC (IP Camera) as an example.

[0099] Among them, NVR: Network video recorder, NVR is connected to the video encoder through the network to complete the access, storage and forwarding of the video.

[0100] IPC: IP Camera, a video encoder that transmits video signals over the network.

[0101] RTC chip: Real-time clock chip (Real-time-chip), an integrated circuit module with an independent battery and crystal oscillator, which can run continuously and provide time for other devices such as NVR.

[0102] In networking devices such as NVRs (Network Video Recorders), a real-time clock chip is provided.

[0103] The specific steps are as follows:

[0104] Step S10, initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal;

[0105] As an example, the first networking device may be a network video recorder. Of course, the first networking device may also be other electronic devices with a recording function, without specific limitation. The following description will be made using the example of the first networking device being an NVR.

[0106] As an example, the NVR can be communicatively connected with different second network devices. Specifically, the NVR is communicatively connected with different second network devices in a local area network (signaling interaction can be performed).

[0107] As an example, the second group of networking devices may be 5, 10, 20, 10,000, etc., without specific limitation.

[0108] As an example, the specific application scenario is:

[0109] The NVR needs to be restarted in the event of a power outage. Since the internal CPU cannot determine the specific time when the NVR is restarted under power outage, the RTC chip set inside needs to be used to determine the time. If the RTC chip time confirmation is abnormal, it will cause the NVR system time determination to be abnormal.

[0110] As an example, a configuration file is set in the NVR and the time is recorded using the configuration file. If the power is cut off, the record in the configuration file will be cut off. After the power is turned on again, as long as the time recorded by the RTC is later than the time recorded in the configuration file before the power is cut off, the first time of the RTC is determined to be normal and is used as the system time of the NVR.

[0111] As an example, if the time recorded in the configuration file is 7 pm, after a power outage, the time recorded in the configuration file ends at 7 pm. After power is restored, as long as the time recorded by the RTC is later than the time recorded in the configuration file before the power outage, such as 8 pm (the actual time is 9 pm), the first time of the RTC is determined to be normal and is used as the system time of the NVR (but it is actually abnormal).

[0112] As an example, an initial determination is first made as to whether the status of the real-time clock chip RTC in the first networking device is abnormal, rather than directly comparing the first time recorded by the RTC with the calibration time. This is because if it is determined that the RTC is obviously abnormal, subsequent comparison is not required, thus saving resources.

[0113] As an example, the step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal includes:

[0114] Step S11: If at least one of the following conditions exists, it is determined that the state of the real-time clock chip RTC in the first networking device is abnormal:

[0115] The RTC reading interface reports an error;

[0116] The RTC reading is 0;

[0117] There are abnormal values ​​in the time field of the RTC reading;

[0118] A deviation between a first time variation recorded by the RTC after a second preset time period and a second system time variation recorded by the second networking device after the second preset time period is not within a preset time difference range.

[0119] As an example, Figure 4 As shown:

[0120] After reading the RTC time, the following logic is used to determine whether the RTC's first time is abnormal:

[0121] Whether the RTC reading interface reports an error. If so, it is abnormal and subsequent logic is not executed.

[0122] If the RTC reading interface is correct, determine whether the RTC reading is 0. If it is 0, it is an exception and the subsequent logic is not executed.

[0123] If it is not 0, determine whether the year, month, day, hour, minute, and second fields of the RTC reading have abnormal values ​​(such as month is 13, minutes is 61, etc.). If so, it is an exception and the subsequent logic is not executed.

[0124] If there is no abnormal value, determine the first time change recorded by the RTC after the second preset time period, and determine the second system time change recorded by the networking device after the second preset time period, and determine whether the deviation between the two is within the preset time difference range. If it is not within the preset time difference range, it is an abnormality and the subsequent logic is not executed.

[0125] As an example, if the current RTC time is 7 pm and the system time is 8 am, 5 minutes later, the system time is 8:05 am. At this time, if the RTC time, that is, the first time, is not 7:05 pm, or the deviation between the two is not within 3s (the deviation between the RTC time and 7:05 is not within 3s, or the deviation between the RTC time and 7 pm is not within 3s), the RTC time is abnormal.

[0126] As an example, once any of the above RTC states occurs, it is considered that the RTC is currently in an abnormal state.

[0127] If none of the above RTC states appear, it is determined that the RTC is temporarily normal or temporarily valid.

[0128] As an example, the step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal further includes:

[0129] Determine whether the RTC reading interface reports an error;

[0130] If no error is reported, determining whether the RTC reading is 0;

[0131] If it is not 0, determining whether there is an abnormal value in the time field of the RTC reading;

[0132] If no abnormal value exists, determining whether a deviation between the first time variation recorded by the RTC after the second preset time period and the second system time variation recorded by the second networking device after the second preset time period is within a preset time difference range;

[0133] If the time difference is within the preset range, the state of the RTC is determined to be normal; if the time difference is not within the preset range, the state of the RTC is determined to be abnormal.

[0134] As an example, if the RTC reading time is a random value, it may still be determined as a normal RTC, and the RTC reading time is used as the system time (which is actually not the accurate time).

[0135] Step S20: If the state of the RTC is normal, comparing the first time recorded by the RTC with the calibration time determined by multiple second networking devices in communication with the first networking device to obtain a first time offset, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment;

[0136] As an example, the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment.

[0137] As an example, if the state of the RTC is normal, the time of the second networking device connected to the NVR is read and analyzed to obtain a calibration time of the local area network, and its time credibility is evaluated to ultimately achieve accurate determination of the system time.

[0138] As an example, the calibration time is determined based on multiple second networking devices rather than one second networking device, avoiding inaccuracy of the second system time recorded by the second networking device due to accidental factors, thereby affecting the accurate determination of the NVR system time.

[0139] As an example, the calibration time is determined by multiple second networking devices connected to the networking device in the local area network, so as to avoid inconsistency in the second system time recorded by different second networking devices due to the wide area, which affects the accurate determination of the NVR system time.

[0140] As an example, see Figure 2 Before the step of comparing the first time recorded by the RTC with calibration times determined by a plurality of second networking devices in communication with the first networking device to obtain a first time deviation, the method includes:

[0141] Step S01: Classify the second target networking devices whose second time deviations are within a first preset duration into one category; wherein, after sorting the second networking devices from largest to smallest or from smallest to largest based on the second system time, the second time deviation is determined as the difference between the second system times corresponding to the largest time span after sorting, and the largest time span is less than the first preset duration;

[0142] wherein, determining a second networking device corresponding to a second system time within the maximum time span as a second target networking device;

[0143] As an example, the first preset time length may be 5 minutes, that is, the second target networking devices whose second time deviations are within 5 minutes are classified into one category.

[0144] As an example, before classification, the second networking devices are sorted from large to small or from small to large based on the second system time of the second networking devices. After sorting, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than 5 minutes. For example, if the maximum time span is less than 5 minutes, and the second system time with the largest time span after sorting is the 5th second system time and the 10th second system time, then the second time deviation is the time difference between the 5th second system time and the 10th second system time.

[0145] Step S02: determining a target group with the largest number of second target networking device groups from the classified second target networking device groups, and taking the average value of the second system time recorded by each second target networking device in the target group as the calibration time.

[0146] As an example, there are multiple classified second target networking device groups.

[0147] As an example, a target group with the largest number of devices is determined from the classified second target networking device groups, and an average value of the second system time recorded by each second target networking device in the target group is used as the calibration time.

[0148] As an example, Figure 2 As shown, reading the second system time recorded by each second networking device in a plurality of second networking devices connected to the first networking device;

[0149] As an example, Figure 5 As shown, the second networking devices whose second time deviations are within 5 minutes are classified into one category.

[0150] As an example, the classified second networking devices include 2 or more second networking devices.

[0151] As an example, based on the second system time, the second networking devices are sorted, and a second time offset between two adjacent second networking devices is determined;

[0152] As an example, based on the second system time, the second networking devices are sorted from largest to smallest, or the second networking devices are sorted from smallest to largest, which is not specifically limited.

[0153] As an example, the second networking devices are sorted from largest to smallest based on the second system time for specific description.

[0154] As an example, the second time offset between two adjacent second networking devices is determined, such as Figure 6 As shown, the second time offset between two adjacent second networking devices is 10 minutes and 12 seconds, 1 minute and 0 seconds, 1 minute and 0 seconds, 1 minute and 1 second, 2 minutes and 1 second, 0 minutes and 10 seconds, and 0 minutes and 3 seconds.

[0155] As an example, starting from the first second networking device, the second time offset is accumulated backward, and all second networking devices whose accumulated second time offsets are within a first preset time length (5 minutes) are classified into one category;

[0156] As an example, Figure 6As shown, starting from the first second networking device (the corresponding second system time is 1 minute and 8 seconds), the second time offset is accumulated backward (the second time offset between the first second networking device and the second second networking device, plus the second time offset between the second second networking device and the third second networking device, plus the second time offset between the n-1th second networking device and the nth second networking device, until the number of seconds corresponding to the second time offset is greater than 5 minutes), and all second networking devices with the accumulated second time offset within the first preset time length are classified into one category (the number of second networking devices with a time offset less than 5 minutes can also be 0).

[0157] As an example, after the classification is completed, starting from the second second networking device, the second time offset is accumulated backward, and all second networking devices with the accumulated second time offset within the first preset time period are classified into one category, until the classification process starting from the last second networking device is completed;

[0158] After the classification is completed, Figure 6 As shown, starting from the second second networking device (corresponding to the second system time of 11 minutes and 20 seconds), the second time deviation is accumulated backward, and all second networking devices with the accumulated second time deviation within the first preset time length are classified into one category, until the classification process starting from the last second networking device is completed.

[0159] As an example, a target group (or multiple groups) with the largest number of second networking devices is determined from the classified second networking device groups, and the average value of the second system time recorded by the second networking devices in the target group is used as the calibration time.

[0160] Determine a target group with the largest number of second networking devices from the classified second networking device groups, and use the average value of the second system time recorded by the second networking devices in the target group as the calibration time. That is, find a group with the largest number of second networking devices, and calculate the average value of its corresponding second system time as the calibration time of the local area network.

[0161] Step S30: According to a comparison result between the first time deviation and a preset deviation, the system time of the first networking device is determined as the first time or the calibration time.

[0162] In this embodiment, the system time of the first networking device is determined according to the first time offset, rather than arbitrarily determining the system time.

[0163] As an example, if the first time deviation is less than or equal to a preset deviation, the first time is determined as the system time.

[0164] In this embodiment, if the first time deviation is less than or equal to the preset deviation, that is, the first time is not much different from the calibration time, then the first time is further verified to be accurate, and then the first time is determined as the system time.

[0165] As an example, if the first time deviation is greater than a preset deviation, the calibration time is determined as the system time.

[0166] After the step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal, the method further includes:

[0167] If the state of the RTC is abnormal, the calibration time is used as the system time.

[0168] As an example, if the state of the RTC is abnormal, the calibration time is used as the system time to avoid the system time being unable to be accurately determined due to the abnormal state of the RTC.

[0169] The present application provides a networking device, a clock exception processing method, an apparatus, a device and a storage medium. Compared with the prior art in which the system time of the networking device cannot be accurately determined, in the present application, an initial determination is made as to whether the status of a real-time clock chip RTC in a first networking device is abnormal; if the status of the RTC is not abnormal, the first time recorded by the RTC is compared with the calibration time determined by multiple second networking devices that are communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment; based on the comparison result of the first time deviation and the preset deviation, the system time of the first networking device is determined as the first time or the calibration time. In the present application, the situation in which the system time cannot be accurately determined due to inaccurate identification of whether the RTC is abnormal is avoided. Instead, when it is determined that the RTC is normal, the first time recorded by the RTC is further compared with the calibration time determined by multiple second networking devices to obtain a first time deviation (the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment). Then, based on the first time deviation, the system time of the networking device is determined. Since the further determination not only considers whether the first time recorded by the RTC is abnormal, but also comprehensively considers the calibration time determined by multiple second networking devices (which can reduce the error of randomly selecting the time of a single second networking device), the system time can be determined more accurately.

[0170] Furthermore, based on the first embodiment of the present application, another embodiment of the present application is provided. In this embodiment, the step of determining the system time of the first networking device as the first time or the calibration time based on the comparison result of the first time deviation and the preset deviation includes:

[0171] Step S31: determining whether the plurality of second system times recorded by the plurality of second networking devices are consistent based on a comparison result of the first time deviation and a preset deviation;

[0172] Step S32: If the time is consistent, the system time of the first networking device is determined as the calibration time;

[0173] Step S33: If there is no consistency, the system time of the first networking device is determined as the first time.

[0174] In this embodiment, whether the multiple second system times recorded by the second networking device are consistent (determining whether the multiple second system times are credible) is used to determine whether they can be used as the standard for the system time of the first networking device.

[0175] The step of determining whether the multiple second system times recorded by the multiple second networking devices are consistent based on the comparison result of the first time deviation and the preset deviation includes:

[0176] Step A1: if the first time deviation is greater than a preset deviation, determining the level of the calibration time;

[0177] Step A2: If the level of the calibration time is the first level, determining whether the multiple second system times recorded by the multiple second networking devices are consistent;

[0178] Step A3: If the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent;

[0179] like Figure 7 As shown, in this embodiment, the final time is determined according to the first time obtained above and the calibration time level.

[0180] The specific determination logic is as follows:

[0181] If the RTC status has been initially determined to be abnormal, the "local LAN time" or calibration time will be used directly as the final system time;

[0182] If the RTC state is not initially determined to be non-abnormal, after determining the first time offset between the first time of the RTC and the calibration time, it is necessary to further compare the first time offset with a preset offset.

[0183] As an example, if the first time deviation is greater than 24 hours (preset deviation), then continue to determine the level of the calibration time:

[0184] If the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above the preset ratio (80%), the level of the calibration time is the first level; if it is below the preset ratio (80%), the level of the calibration time is the second level.

[0185] If the calibration time is level A (first level), select the level of the calibration time as the system time.

[0186] If the calibration time is level B (second level), the first time of the RTC is still selected as the system time.

[0187] In this embodiment, whether the plurality of second system times recorded by the plurality of second networking devices are consistent is determined based on a comparison result of the first time deviation and a preset deviation;

[0188] If they are consistent, determining the system time of the first networking device as the calibration time;

[0189] If there is no consistency, the system time of the first networking device is determined as the first time. In this embodiment, when the second system time of the target group is a highly reliable time, it is used as the system time to improve the accuracy of determining the system time.

[0190] Reference Figure 3 , Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.

[0191] like Figure 3 As shown, the device clock exception processing device may include: a processor 1001 , a memory 1005 , and a communication bus 1002 . The communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005 .

[0192] Optionally, the device clock anomaly handling device may further include a user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, a WiFi module, and the like. The user interface may include a display screen and an input submodule such as a keyboard. The optional user interface may further include a standard wired interface and a wireless interface. The network interface may include a standard wired interface and a wireless interface (such as a WiFi interface).

[0193] Those skilled in the art will understand that Figure 3The device clock exception processing device structure shown in the figure does not constitute a limitation on the device clock exception processing device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0194] like Figure 3 As shown, memory 1005, which serves as a storage medium, may include an operating system, a network communication module, and a device clock exception handling program. The operating system is a program that manages and controls the hardware and software resources of the device clock exception handling device and supports the operation of the device clock exception handling program and other software and / or programs. The network communication module is used to enable communication between the various components within memory 1005, as well as communication with other hardware and software in the device clock exception handling system.

[0195] exist Figure 3 In the device clock exception processing device shown, the processor 1001 is used to execute the device clock exception processing program stored in the memory 1005 to implement the steps of any of the above-mentioned clock exception processing methods.

[0196] The specific implementation of the device clock exception processing device of the present application is basically the same as the various embodiments of the clock exception processing method described above, and will not be repeated here.

[0197] The present application further provides a networking device, the networking device being a first networking device, wherein a real-time clock chip RTC is provided in the first networking device, an independent battery and a crystal oscillator are provided in the RTC, and the RTC provides system time for the first networking device based on the independent battery and the crystal oscillator, the first networking device is communicatively connected to a plurality of second networking devices, and the first networking device further comprises:

[0198] The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal;

[0199] a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment;

[0200] A time arbitration module is configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result between the first time deviation and a preset deviation.

[0201] In a possible implementation manner of the present application, the networking device further includes:

[0202] A classification module is used to classify the second target networking devices whose second time deviations are within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than the first preset time length; wherein the second networking device corresponding to the second system time between the maximum time spans is determined as the second target networking device; a determination module is used to determine the target group with the largest number from the classified second target networking device groups, and use the average value of the second system time recorded by each second target networking device in the target group as the calibration time;

[0203] And / or, the time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; and a third determining unit is configured to, if they are not consistent, determine the system time of the first networking device as the first time;

[0204] And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level;

[0205] And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range;

[0206] And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

[0207] In a possible implementation of the present application, a real-time clock chip RTC is provided in both the first networking device and the second networking device. After the first networking device passes the authentication of the second networking device based on a preset communication protocol, the first networking device performs signaling interaction with the second networking device to obtain the second system time recorded by the real-time clock chip RTC in the second networking device.

[0208] The specific implementation of the networking device of the present application is basically the same as the embodiments of the above-mentioned clock anomaly processing method, and will not be repeated here.

[0209] The present application also provides a device clock abnormality processing device, the device comprising:

[0210] The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal;

[0211] a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment;

[0212] A time arbitration module is configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result between the first time deviation and a preset deviation.

[0213] In a possible embodiment of the present application, the device further includes: a classification module, used to classify the second target networking devices whose second time deviation is within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times with the largest time span after sorting, and the maximum time span is less than the first preset time length; wherein, the second networking device corresponding to the second system time between the maximum time spans is determined as the second target networking device; a determination module, used to determine a target group with the largest number from the classified second target networking device group, and use the average value of the second system time recorded by each second target networking device in the target group as the calibration time;

[0214] And / or, the time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; and a third determining unit is configured to, if they are not consistent, determine the system time of the first networking device as the first time;

[0215] And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level;

[0216] And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range;

[0217] And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

[0218] The specific implementation of the device clock anomaly processing apparatus of the present application is basically the same as the embodiments of the above-mentioned clock anomaly processing method, and will not be repeated here.

[0219] An embodiment of the present application provides a storage medium, and the storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned clock exception processing methods.

[0220] The specific implementation of the storage medium of the present application is basically the same as the embodiments of the above-mentioned clock abnormality processing method, and will not be repeated here.

[0221] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned clock exception processing method when executed by a processor.

[0222] The specific implementation of the computer program product of the present application is basically the same as the various embodiments of the above-mentioned clock anomaly processing method, and will not be repeated here.

[0223] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0224] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.

[0225] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus hardware platform, or by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM) and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0226] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A networking device, characterized in that: The networking device is a first networking device, wherein a real-time clock chip RTC is provided in the first networking device, an independent battery and a crystal oscillator are provided in the RTC, and the RTC provides system time for the first networking device based on the independent battery and the crystal oscillator, the first networking device is communicatively connected with a plurality of second networking devices, and the first networking device further comprises: The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal; a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment; a time arbitration module, configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result of the first time deviation and a preset deviation; A classification module, configured to classify second target networking devices whose second time deviations are within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times corresponding to the largest time span after sorting, and the largest time span is less than the first preset time length; wherein the second networking device corresponding to the second system time between the largest time spans is determined as the second target networking device; The determination module is configured to determine a target group with the largest number of devices from the classified second target networking device groups, and use an average value of the second system time recorded by each second target networking device in the target group as the calibration time.

2. The networking device according to claim 1, wherein: The time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; a third determining unit, configured to determine the system time of the first networking device as the first time if there is no consistency; And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level; And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range; And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

3. The networking device according to any one of claims 1 to 2, characterized in that: Both the first networking device and the second networking device are equipped with a real-time clock chip RTC. After the first networking device passes the authentication of the second networking device based on a preset communication protocol, the first networking device performs signaling interaction with the second networking device to obtain the second system time recorded by the real-time clock chip RTC in the second networking device.

4. A clock abnormality processing method, characterized in that: Applied to a first networking device, the method includes: Initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal; If the state of the RTC is not abnormal, comparing the first time recorded by the RTC with calibration times determined by multiple second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is the first system time recorded by the RTC at the current moment, and the calibration time is calculated based on the second system time recorded by each second networking device at the current moment; Determining the system time of the first networking device as the first time or the calibration time according to a comparison result of the first time deviation and a preset deviation; Before the step of comparing the first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, the method includes: Classifying the second target networking devices whose second time deviations are within the first preset duration into one category; wherein, after sorting the second networking devices from largest to smallest or from smallest to largest based on the second system time, determining the second time deviation as the difference between the second system times corresponding to the largest time span after sorting, and the largest time span is less than the first preset duration; The second networking device corresponding to the second system time within the maximum time span is determined as the second target networking device; A target group with the largest number of devices is determined from the classified second target networking device groups, and an average value of the second system time recorded by each second target networking device in the target group is used as the calibration time.

5. The clock abnormality processing method according to claim 4, wherein: The step of determining the system time of the first networking device as the first time or the calibration time according to a comparison result of the first time deviation and a preset deviation includes: Determining whether the multiple second system times recorded by the multiple second networking devices are consistent based on a comparison result of the first time deviation and a preset deviation; If they are consistent, determining the system time of the first networking device as the calibration time; If there is no consistency, the system time of the first networking device is determined as the first time.

6. The clock abnormality processing method according to claim 5, wherein: The step of determining whether the plurality of second system times recorded by the plurality of second networking devices are consistent based on a comparison result of the first time deviation and a preset deviation includes: If the first time deviation is greater than a preset deviation, determining the level of the calibration time; If the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; If the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; Among them, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above the preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level.

7. The clock abnormality processing method according to claim 4, wherein: The step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal includes: If at least one of the following conditions exists, it is determined that the state of the real-time clock chip RTC in the first networking device is abnormal: The RTC reading interface reports an error; The RTC reading is 0; There are abnormal values ​​in the time field of the RTC reading; A deviation between a first time variation recorded by the RTC after a second preset time period and a second system time variation recorded by the second networking device after the second preset time period is not within a preset time difference range.

8. The clock abnormality processing method according to claim 4, wherein: The step of initially determining whether the state of the real-time clock chip RTC in the first networking device is abnormal also includes: Determine whether the RTC reading interface reports an error; If no error is reported, determining whether the RTC reading is 0; If it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; If no abnormal value exists, determining whether a deviation between the first time variation recorded by the RTC after the second preset time period and the second system time variation recorded by the second networking device after the second preset time period is within a preset time difference range; If it is within the preset time difference range, it is determined that the state of the RTC is not abnormal.

9. A device for handling device clock anomalies, characterized in that: The device comprises: The RTC abnormality check module is used to initially determine whether the state of the real-time clock chip RTC is abnormal; a calibration time determination module, configured to, if the state of the RTC is normal, compare a first time recorded by the RTC with calibration times determined by a plurality of second networking devices communicatively connected to the first networking device to obtain a first time deviation, wherein the first time is a first system time recorded by the RTC at the current moment, and the calibration time is calculated based on a second system time recorded by each second networking device at the current moment; a time arbitration module, configured to determine the system time of the first networking device as the first time or the calibration time according to a comparison result of the first time deviation and a preset deviation; A classification module, configured to classify second target networking devices whose second time deviations are within a first preset time length into one category; wherein, after sorting the second networking devices from large to small or from small to large based on the second system time, the second time deviation is determined as the difference between the second system times corresponding to the largest time span after sorting, and the largest time span is less than the first preset time length; wherein the second networking device corresponding to the second system time between the largest time spans is determined as the second target networking device; The determination module is configured to determine a target group with the largest number of devices from the classified second target networking device groups, and use an average value of the second system time recorded by each second target networking device in the target group as the calibration time.

10. The device clock abnormality processing apparatus according to claim 9, wherein: The time arbitration module is configured to: determine, based on a comparison result of the first time deviation and a preset deviation, whether the multiple second system times recorded by the multiple second networking devices are consistent; if they are consistent, determine the system time of the first networking device as the calibration time; a third determining unit, configured to determine the system time of the first networking device as the first time if there is no consistency; And / or, the time arbitration module is further configured to implement: if the first time deviation is greater than a preset deviation, determining the level of the calibration time; if the level of the calibration time is the first level, determining that the multiple second system times recorded by the multiple second networking devices are consistent; if the level of the calibration time is the second level, determining that the multiple second system times recorded by the multiple second networking devices are inconsistent; wherein, if the ratio of the number of second networking devices in the target group to the sum of the number of all second networking devices is above a preset ratio, the level of the calibration time is the first level; if it is below the preset ratio, the level of the calibration time is the second level; And / or, the RTC abnormality checking module is configured to: determine that the state of the real-time clock chip RTC in the first networking device is abnormal if at least one of the following exists: the reading interface of the RTC reports an error; the reading of the RTC is 0; the time field of the RTC reading contains an abnormal value; the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is not within a preset time difference range; And / or, the RTC abnormality check module is also used to implement: determining whether the reading interface of the RTC reports an error; if no error is reported, determining whether the reading of the RTC is 0; if it is not 0, determining whether there is an abnormal value in the time field of the RTC reading; if there is no abnormal value, determining whether the deviation between the first time change recorded by the RTC after a second preset time period and the second system time change recorded by the second networking device after the second preset time period is within a preset time difference range; if it is within the preset time difference range, determining that the status of the RTC is non-abnormal.

11. A device for handling device clock anomalies, characterized in that: The device comprises a memory, a processor and a device clock exception handling program stored in the memory and executable on the processor. When the processor executes the device clock exception handling program, the steps of the clock exception handling method according to any one of claims 4 to 8 are implemented.

12. A storage medium, characterized in that: The storage medium stores a device clock exception handling program, which, when executed by a processor, implements the steps of the clock exception handling method according to any one of claims 4 to 8.

Citation Information

Patent Citations

  • Real time clock correction circuit and real time clock correction method

    JP2012234275A