Time correction method, device and vehicle based on multiple time sources
By using a multi-time source verification time correction method after the vehicle system is powered off and restarted, the time unreliability problem caused by GNSS and NTP timing attacks is solved, and the reliability and security of the system are improved.
Patent Information
- Application Number
- CN202210712704.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-22
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-06-22
AI Technical Summary
After the vehicle system suffers a GNSS and NTP timing attack, the time becomes unreliable, leading to system errors and reduced security.
After the vehicle system is powered off and restarted, the historical time and current time are read to determine their credibility. If they are not credible, the verification time of multiple time sources is obtained to determine their credibility, and the time is calibrated based on the credible verification time.
Improves the reliability and security of system time and ensures that the system is available after the time is corrected.
Smart Images

Figure CN115102656B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle networking, and in particular to a time correction method, device and vehicle based on multiple time sources. Background Art
[0002] Currently, most vehicle head units use the Network Time Protocol (NTP) service or GNSS (global navigation satellite system) time to update system time. This improves GNSS reliability, thereby enhancing network security and preventing signal errors from causing time errors and potentially causing serious system consequences. However, GNSS is susceptible to interference and attacks. If attacked or experiencing anomalies, the calculated time will be incorrect, rendering GNSS time unreliable. Furthermore, NTP timing can also cause time errors after security attacks. Summary of the Invention
[0003] In a first aspect, the present invention provides a time correction method based on multiple time sources, the method comprising:
[0004] After the vehicle system is powered off and restarted, read the system's current time and recorded historical time;
[0005] Determining whether the current time is credible based on the historical time;
[0006] If the current time is unreliable, multiple verification times are obtained, where the multiple verification times are times returned by synchronously obtaining timing from multiple time sources;
[0007] determining whether the multiple verification times are credible;
[0008] The current time is adjusted based on the credible verification time.
[0009] In an optional embodiment, the method further comprises:
[0010] If the current time is credible, continue normal operation at the current time;
[0011] During normal operation, multiple verification times are continuously obtained, and the current time is re-calibrated using the trusted verification time among the multiple verification times.
[0012] In an optional implementation manner, the historical time is the software compilation time of the system, and determining whether the current time is credible based on the historical time includes:
[0013] Comparing the software compilation time and the running time, the running time being the difference between the time when the system is restarted and the current time;
[0014] If the running time is less than or equal to the software compiling time, determining that the current time is unreliable;
[0015] When the running time is greater than the software compiling time, it is determined that the current time is credible.
[0016] In an optional implementation manner, the historical time is a previous trusted time of the system, and determining whether the current time is trusted based on the historical time includes:
[0017] Obtaining a difference time based on a difference between the previous trusted time and the current time;
[0018] Determining whether the time difference is less than a preset time difference;
[0019] When the time difference is less than the preset time difference, it is determined that the current time is unreliable;
[0020] When the difference time is greater than or equal to the preset time difference, it is determined that the current time is credible.
[0021] In an optional embodiment, the process of obtaining multiple verification times further includes:
[0022] When the first verification time is obtained, the current time is pre-calibrated based on the first verification time.
[0023] In an optional implementation manner, determining whether the verification time is credible includes:
[0024] When the verification times corresponding to the two time sources are obtained, the difference between the two verification times is calculated to obtain the corresponding verification time difference;
[0025] Determining whether the verification time difference is less than a preset verification time difference;
[0026] When the verification time difference is less than the preset verification time difference, it is determined that the two current verification times are credible.
[0027] In an optional embodiment, the method further comprises:
[0028] When the verification time difference is greater than or equal to the preset verification time difference, determining that the two current verification times are unreliable, and continuing to obtain the next verification time;
[0029] Calculate the difference between the next verification time and all the obtained verification times to obtain multiple corresponding verification time differences, and return to execute the step of determining whether the verification time difference is less than the preset verification time difference.
[0030] In a second aspect, the present invention provides a time correction device based on multiple time sources, the device comprising:
[0031] An acquisition module is used to read the current time and recorded historical time of the system after the vehicle system is powered off and restarted;
[0032] A historical time determination module, configured to determine whether the current time is credible based on the historical time;
[0033] A verification time acquisition module is used to obtain multiple verification times if the current time is unreliable, wherein the multiple verification times are times returned by synchronously obtaining timing from multiple time sources;
[0034] A verification time determination module, configured to determine whether the plurality of verification times are credible;
[0035] The time calibration module is used to calibrate the current time based on the reliable verification time.
[0036] In a third aspect, the present invention provides a vehicle comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the time correction method based on multiple time sources is executed.
[0037] In a fourth aspect, the present invention provides a readable storage medium storing a computer program, which executes the time correction method based on multiple time sources when running on a processor.
[0038] The embodiments of the present application have the following beneficial effects:
[0039] The time correction method based on multiple time sources provided in the embodiments of the present application reads the system's current time and recorded historical time after the vehicle system is powered off and restarted, determines whether the current time is credible based on the historical time, and if the current time is not credible, obtains multiple verification times, which are the times returned by synchronously obtaining timing from multiple time sources, determines whether the multiple verification times are credible, and corrects the current time based on the credible verification times. This application can not only delay the system's correction time to improve system security, but also improve system reliability to ensure system availability. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.
[0041] Figure 1 A first flow chart of a time correction method based on multiple time sources proposed in an embodiment of the present application is shown;
[0042] Figure 2 A schematic diagram of a first process for determining the current time in a time correction method based on multiple time sources proposed in an embodiment of the present application is shown;
[0043] Figure 3 A second flow chart of determining the current time in a time correction method based on multiple time sources proposed in an embodiment of the present application is shown;
[0044] Figure 4 A schematic diagram of a process for determining a reliable verification time in a time correction method based on multiple time sources proposed in an embodiment of the present application is shown;
[0045] Figure 5 A second flow chart of a time correction method based on multiple time sources proposed in an embodiment of the present application is shown;
[0046] Figure 6 A schematic structural diagram of a time correction device based on multiple time sources proposed in an embodiment of the present application is shown.
[0047] Description of main component symbols:
[0048] 10-time correction device based on multiple time sources; 11-acquisition module; 12-historical time determination module; 13-verification time acquisition module; 14-verification time determination module; 15-time calibration module. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0050] The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the figures is not intended to limit the scope of the claimed invention, but rather merely represents selected embodiments of the present invention. All other embodiments derived by those skilled in the art based on the embodiments of the present invention without inventive effort are intended to be within the scope of protection of the present invention.
[0051] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or the possibility of adding one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0052] Furthermore, the terms “first,” “second,” “third,” etc., are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0053] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those skilled in the art to which the various embodiments of the present invention pertain. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meaning as in the context of the relevant technical field and will not be interpreted as having an idealized meaning or an overly formal meaning unless clearly defined in the various embodiments of the present invention.
[0054] Example 1
[0055] Please refer to Figure 1 , an embodiment of the present application proposes a time correction method based on multiple time sources. Exemplarily, the time correction method based on multiple time sources includes steps S100 to S500.
[0056] Step S100: After the vehicle system is powered off and restarted, the current time and recorded historical time of the system are read.
[0057] It's understandable that autonomous driving requires a significant amount of sensor data. If the system receives inconsistent time from various sensors, it can lead to inaccurate obstacle recognition and other issues. Therefore, the accuracy of the vehicle's system time is crucial. The onboard host computer is the core component of the vehicle. In this embodiment, the time is the clock information of the onboard host computer. When the vehicle system detects a power outage and restarts, the system clock's current time and recorded historical time are retrieved to further determine the system's reliability.
[0058] Step S200: Determine whether the current time is credible based on historical time.
[0059] After obtaining the current time of the vehicle system, the reliability of the current time is determined based on the current time and the recorded historical time. For example, the historical time can be any one of the vehicle system's software compilation time and the system's previous trusted time. The system's software compilation time (compiling time) refers to the time taken by the compiler to compile the source program into the target program; the vehicle's previous trusted time is the last trusted time recorded when the system was last started and operating normally. The trusted time refers to the consistency of the vehicle system terminal's own clock time with two or more clock sources; or the vehicle system's clock time satisfies the requirement that the actual running time from startup to the current time is less than or equal to the system's software compilation time.
[0060] In one embodiment, Figure 2 As shown, when the historical time is the system software compilation time, step S200 includes sub-steps S210 to S230.
[0061] Sub-step S210: Compare the software compilation time and the running time, where the running time is the difference between the time when the system is restarted and the current time.
[0062] In this embodiment, the vehicle's historical time is recorded in advance. When the recorded historical time is the vehicle system's software compile time, after obtaining the software compile time, the software compile time is compared with the vehicle system's actual runtime. Since it takes a certain amount of time for the system to restart and successfully start, the runtime is the difference between the system restart clock time and the current actual runtime. The runtime cannot be less than or equal to the system's software compile time. Therefore, comparing the system's software compile time with the system's runtime time can determine whether the current time is reliable.
[0063] Sub-step S220: If the running time is less than or equal to the software compilation time, it is determined that the current time is unreliable.
[0064] When the system's running time after restart is less than or equal to the system's software compilation time, that is, when the current time is before the software compilation time, it is determined that the current time is wrong. In other words, the current time at this time is unreliable and cannot be used as the system clock time.
[0065] Sub-step S230: If the current time is greater than the software compilation time, it is determined that the current time is credible.
[0066] When the system's running time after restart is greater than the software compilation time, it can be determined that the current time is credible. In this case, the system time is normal and will run normally at the current time.
[0067] In one embodiment, Figure 3 As shown, when the historical time is the previous trusted time of the system, step S200 includes sub-steps S240 to S270.
[0068] Sub-step S240: obtaining a differential time based on the difference between the previous trusted time and the current time.
[0069] In this embodiment, the system's last trusted time is recorded in memory and used as historical time. Each time the vehicle's system is powered on, the time elapsed between the current time and the last trusted time is measured. In other words, the difference between the last trusted time and the current time is calculated to obtain the corresponding difference time.
[0070] Sub-step S250: Determine whether the time difference is less than a preset time difference.
[0071] After calculating the difference between the previous credible time and the current time, it is determined whether the corresponding difference is less than a preset time difference, thereby determining whether the current time is credible. The preset time difference can be set according to actual conditions.
[0072] Sub-step S260: When the time difference is less than the preset time difference, it is determined that the current time is unreliable.
[0073] When the difference time is less than the preset time difference, it can be determined that the current time is unreliable. At this time, the current time of the vehicle system clock is wrong and the current time of the system needs to be corrected to facilitate subsequent logic control, important data reporting, and log recording.
[0074] Sub-step S270: When the time difference is greater than or equal to the preset time difference, it is determined that the current time is credible.
[0075] When the time difference is greater than or equal to the preset time difference, the current time is determined to be credible. At this time, the system time is normal and will operate normally at the current time.
[0076] Exemplarily, when the preset time difference is 1 week, if the difference between the trusted time of the previous time synchronization and the current time is the difference time, if the difference time is less than 1 week, the current time is determined to be unreliable; if the difference time is greater than or equal to 1 week, the current time is determined to be reliable.
[0077] Step S300: If the current time is not credible, multiple verification times are obtained, where the multiple verification times are times returned by synchronously obtaining timing from multiple time sources.
[0078] If the current time is unreliable, a time acquisition command is sent simultaneously to multiple time sources to obtain the time corresponding to each time source, i.e., the verification time corresponding to each independent time. When the vehicle system obtains the verification time feedback from multiple time sources, the multiple time sources will synchronously obtain the time returned by the timing service. In other words, the time sources will obtain the timing from the corresponding organization, device, or server, i.e., the time returned by the timing service. When the vehicle system obtains multiple verification times, the multiple verification times returned are in a certain order.
[0079] In this embodiment, the time source is an organization or device system that can provide standard time UTC (Universal Coordinated Time), such as satellite systems such as Beidou and GNSS, and NTP servers connected via the Internet. Multiple time sources include, but are not limited to, GNSS and multiple NTP servers, as well as a combination of at least one GNSS and at least one NTP server. For example, in this embodiment, three time sources may be included, namely, one GNSS and two NTP servers. When obtaining the corresponding verification time, the time corresponding to the one GNSS and two NTP servers is obtained.
[0080] Step S400: Determine whether the multiple verification times are credible.
[0081] In this embodiment, when multiple time sources feedback verification times to the system, because there is a sequence in the feedback, the obtained verification times can be marked as the first verification time, the second verification time, the third verification time, etc. according to the order in which the verification times were obtained. After obtaining at least one verification time feedback from multiple time sources, it can be determined whether the at least one verification time obtained is reliable. A reliable time is a time when the verification times feedback from at least two of the multiple time sources are the same. The same verification time is then considered reliable and used as the time reference for system time calibration, ensuring that the current time of the system clock is reliable.
[0082] In one embodiment, the process of obtaining multiple verification times further includes sub-step S410.
[0083] Sub-step S410: When the first verification time is obtained, the current time is pre-calibrated based on the first verification time.
[0084] When the first verification time is obtained, the current time of the system clock will be calibrated based on the first verification time, that is, the first verification time will be used as the current time of the vehicle system clock to complete the timing, and the first verification time will be marked as unreliable. The first time is the verification time fed back by any time source among multiple time sources.
[0085] For example, when the time source includes one GNSS and two NTP servers, if the first verified time received by the system is the time reported by the GNSS, the verified time reported by the GNSS will be used as the system's current time and marked as unreliable. If the current time is unreliable, it can only be used for important data reporting and logging, and cannot be used for important operations such as logic control.
[0086] like Figure 4 As shown, step S400 includes sub-steps S420 to S450.
[0087] Sub-step S420: When the check times corresponding to the two time sources are obtained, the difference between the two check times is calculated to obtain the check time difference.
[0088] In this embodiment, after receiving the first verified time from a time source, the system will continue to receive times from the remaining time sources. In other words, after simultaneously issuing time acquisition commands to multiple time sources, the system will continuously acquire the corresponding verified times from the multiple time sources. When two time sources have received corresponding verified times, the system will calculate the difference between the two first-acquired verified times to obtain the corresponding verified time difference.
[0089] Sub-step S430: Determine whether the verification time difference is less than the preset verification time difference. If the verification time difference is less than the preset verification time difference, execute sub-step S440. If the verification time difference is greater than or equal to the preset verification time difference, execute sub-step S450.
[0090] After the calibration time difference is calculated, the calibration time difference is compared with the preset calibration time difference to determine whether the calibration time difference is less than the preset calibration time difference. The preset calibration time difference can be set according to actual conditions.
[0091] Sub-step S440: Determine whether the two current verification times are credible.
[0092] When the check time difference is less than the preset check time difference, it is determined that the two check times corresponding to the check time difference are both credible. In other words, if the two check times corresponding to the check time difference are the same, it is determined that the time sources corresponding to the two check times are consistent.
[0093] Sub-step S450: Determine that the current two verification times are not credible, and continue to obtain the next verification time.
[0094] If the difference between the check times corresponding to the two time sources obtained is greater than or equal to the preset check time difference, both check times corresponding to the check time difference are determined to be unreliable, and the time source corresponding to the unreliable check time is recorded. The check times corresponding to the remaining time sources that have not yet provided feedback are then obtained. After the next check time is obtained, the next check time is calculated with all the previously obtained check times.
[0095] Sub-step S460: Calculate the difference between the next verification time and all the obtained verification times to obtain a plurality of corresponding verification time differences, and return to execute step S430.
[0096] In this embodiment, when calculating at least two verification times, the difference between the next verification time obtained and all the verification times obtained will be calculated respectively, and multiple corresponding verification time difference values will be obtained. After obtaining the verification time difference values, each verification time difference value will be compared with the preset verification time difference value, that is, step S430 will be executed.
[0097] For example, when the difference between the verification times obtained from two time sources is greater than or equal to the preset verification time difference, the third verification time will be obtained. The three verification times are the second verification time, the third verification time and the fourth verification time. The difference between the second verification time and the fourth verification time is calculated as the first verification time difference, and the difference between the third verification time and the fourth verification time is calculated as the second verification time difference. The first verification time difference and the second verification time difference are respectively compared with the preset verification time difference.
[0098] Exemplarily, when there are four time sources, the verification times corresponding to the four time sources will be obtained, and the verification time differences between the four verification times will be calculated respectively, and six corresponding verification time differences will be obtained. The above six verification time differences will be compared with the preset verification time differences respectively to determine whether there is a verification time difference that is less than the preset verification time difference, that is, to determine whether there is a reliable verification time.
[0099] Furthermore, if the calculated multiple verification time differences are all greater than or equal to the preset verification time difference, in other words, if the obtained multiple verification times are all unreliable, then it is determined that the verification times corresponding to the multiple time sources are all different. In this case, a time acquisition instruction is again sent to the multiple time sources simultaneously to obtain the verification times of the multiple time sources, and step S400 is executed.
[0100] Step S500: calibrate the current time based on the credible verification time.
[0101] If the verified time provided by the time source is confirmed to be reliable, that is, if the two verified times are the same, the system's current time will be calibrated based on either of the two verified times. This means that the system's current time will be used as the reference. Once the verified time is confirmed to be reliable, the system will stop obtaining the verified time from the time source that has not provided a verified time.
[0102] Among them, when the first verification time and the second verification time obtained by the system are the same, the first verification time and the second verification time are both credible. At this time, the current time does not need to be adjusted anymore, that is, the first verification time is still used as the current time.
[0103] Please refer to Figure 5 , exemplary, the time correction method based on multiple time sources also includes steps S600 to S700.
[0104] Step S600: If the current time is credible, continue normal operation with the current time.
[0105] In this embodiment, when the current time is determined to be credible, the system will continue to operate normally at the current time. At this time, the system can perform tasks such as logic control, diary recording, and uploading important data at the current time of the clock.
[0106] Step S700: During normal operation, multiple verification times are continuously obtained, and the current time is re-calibrated using the trusted verification time among the multiple verification times.
[0107] When the system is operating normally, it will continue to check the system clock, that is, continuously obtain the current system time. Because the system clock is operating normally, the clock itself is reliable. When the system is operating normally, it will continue to obtain time from multiple time sources. When the time of multiple time sources changes simultaneously, it will determine the trusted verification time among the verification times corresponding to the multiple time sources and re-calibrate the current system clock time based on the determined trusted verification time.
[0108] Exemplarily, after determining that the vehicle's current time is unreliable, the vehicle's verification time will be obtained. For example, when multiple time sources are GNSS, NTP1 server (i.e., the first NTP server), and NTP2 server (i.e., the second NTP server), after the system is powered on, it will search for satellite signals. After receiving the satellite signal, the satellite's UTC (Universal Coordinated Time) time can be easily obtained from the satellite signal. The satellite's time is t1, that is, the GNSS verification time is set to t1. At this time, when t1 is the first verification time fed back, it will be used as the system's current time, which is unreliable. When the system is successfully connected to the network, it will connect to the NTP1 server. At this time, data will be sent and received according to the NTP protocol, and the UTC time of the NTP1 server will be obtained. The time of the NTP1 server is t2. If it is the second verification time returned by the system. If t1 is equal to t2, the system's current time will be modified based on t1 and t2, that is, the current time is t1 to complete the timing. Among them, the preset verification time difference is 1 second. When the difference between t1 and t2 is less than 1 second, t1 and t2 are considered to be credible, and their corresponding time sources are credible time.
[0109] If t1 is not equal to t2, the system will continue to obtain the time from the next time source, that is, the time from the NTP2 server. The system will connect to the NTP2 server and send and receive data according to the NTP protocol. At this time, the UTC time obtained from the NTP2 server is t3, which is the third verification time received by the system. If t1 is equal to t3, the current system time will be verified based on t1. In other words, the current system time will be changed to t1. If t2 is equal to t3, the current system time will be changed to t2 based on t2, thus completing the system timing. If t1 is not equal to t3 and t2 is not equal to t3, the verification time of the GNSS, NTP1 server, and NTP2 server will be re-obtained.
[0110] If there are other time sources, such as other NTP servers, the system will continue to obtain time sources from other NTP servers and compare them with the previously obtained verification time to determine the reliable verification time, and use this as the benchmark to calibrate the system clock.
[0111] In this embodiment, by simultaneously acquiring timing from multiple time sources and performing mutual correction, not only can the correction time of the system be delayed to improve the security of the system, but also the reliability of the system can be improved to ensure the availability of the system.
[0112] Based on the time correction method based on multiple time sources in the above embodiment, Figure 6 FIG2 shows a schematic diagram of the structure of a time correction device 10 based on multiple time sources provided in an embodiment of the present application. The time correction device 10 based on multiple time sources includes:
[0113] An acquisition module 11 is used to read the current time of the system and the recorded historical time after the vehicle system is powered off and restarted;
[0114] A historical time determination module 12 is used to determine whether the current time is credible based on the historical time;
[0115] A verification time acquisition module 13 is configured to obtain multiple verification times if the current time is unreliable, wherein the multiple verification times are times returned by synchronously obtaining timing from multiple time sources;
[0116] A verification time determination module 14 is configured to determine whether the multiple verification times are credible;
[0117] The time calibration module 15 is configured to calibrate the current time based on the credible verification time.
[0118] This embodiment provides a time correction device 10 based on multiple time sources for executing the time correction method based on multiple time sources in the above embodiment. The implementation schemes and beneficial effects involved in the above embodiment are also applicable to this embodiment and will not be repeated here.
[0119] In addition, the present application also proposes a vehicle, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, the time correction method based on multiple time sources in the above embodiment is executed.
[0120] This embodiment further provides a readable storage medium storing a computer program. When the computer program is run on a processor, the time correction method based on multiple time sources in the above embodiment is executed.
[0121] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions, and operations of the devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or part of a code, and the module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in alternative implementations, the functions marked in the boxes can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or flowchart, as well as the combination of boxes in the structure diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified functions or actions, or can be implemented using a combination of dedicated hardware and computer instructions.
[0122] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0123] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0124] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered by the scope of protection of the present invention.
Claims
1. A time correction method based on multiple time sources, characterized in that: The method comprises: After the vehicle system is powered off and restarted, read the system's current time and recorded historical time; Determining whether the current time is credible based on the historical time; If the current time is unreliable, multiple verification times are obtained, where the multiple verification times are times returned by synchronously obtaining timing from multiple time sources; determining whether the multiple verification times are credible; Correcting the current time based on a reliable verification time; If the current time is credible, continue normal operation at the current time; During normal operation, continue to obtain multiple verification times, and use the trusted verification time among the multiple verification times to re-calibrate the current time; The process of obtaining multiple verification times also includes: When the first verification time is obtained, the current time is pre-calibrated based on the first verification time.
2. The time correction method based on multiple time sources according to claim 1, characterized in that: The historical time is the software compilation time of the system, and determining whether the current time is credible based on the historical time includes: Comparing the software compilation time and the running time, the running time being the difference between the time when the system is restarted and the current time; If the running time is less than or equal to the software compilation time, determining that the current time is unreliable; When the running time is greater than the software compiling time, it is determined that the current time is credible.
3. The time correction method based on multiple time sources according to claim 1, characterized in that: The historical time is the previous trusted time of the system, and determining whether the current time is trusted based on the historical time includes: Obtaining a difference time based on a difference between the previous trusted time and the current time; Determining whether the time difference is less than a preset time difference; When the time difference is less than the preset time difference, it is determined that the current time is unreliable; When the difference time is greater than or equal to the preset time difference, it is determined that the current time is credible.
4. The time correction method based on multiple time sources according to claim 1, characterized in that: Determining whether the multiple verification times are credible includes: When the verification times corresponding to the two time sources are obtained, the difference between the two verification times is calculated to obtain the corresponding verification time difference; Determining whether the verification time difference is less than a preset verification time difference; When the verification time difference is less than the preset verification time difference, it is determined that the two current verification times are credible.
5. The time correction method based on multiple time sources according to claim 4, characterized in that: Also includes: When the verification time difference is greater than or equal to the preset verification time difference, determining that the two current verification times are unreliable, and continuing to obtain the next verification time; Calculate the difference between the next verification time and all the obtained verification times to obtain multiple corresponding verification time differences, and return to execute the step of determining whether the verification time difference is less than the preset verification time difference.
6. A time correction device based on multiple time sources, characterized in that: The device comprises: An acquisition module is used to read the current time and recorded historical time of the system after the vehicle system is powered off and restarted; A historical time determination module, configured to determine whether the current time is credible based on the historical time; Verification time acquisition module for obtaining multiple verification times if the current time is unreliable, wherein the multiple verification times are the time when multiple time sources synchronously obtain timing returns, and further for continuing to obtain multiple verification times during normal operation; The process of obtaining multiple verification times also includes: When the first verification time is obtained, pre-correcting the current time based on the first verification time; A verification time determination module, configured to determine whether the plurality of verification times are credible; The time calibration module is used to calibrate the current time based on the trusted calibration time, and is also used to calibrate the current time again during normal operation using the trusted calibration time among the multiple calibration times.
7. A vehicle, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is run on the processor, the method for time correction based on multiple time sources according to any one of claims 1 to 5 is executed.
8. A readable storage medium, characterized in that: The device stores a computer program, which, when running on a processor, executes the time correction method based on multiple time sources according to any one of claims 1 to 5.
Citation Information
Patent Citations
Time correction method, device, system and equipment and storage medium
CN110855394A
Temporary firmware management and control method
CN114626067A