A System Time Counting Method Based on In-vehicle Charging Piles

By adopting a variety of time calibration methods and optimized time conversion algorithms in the charging pile system, the problem of the RTC clock module not being timed after the charging pile is powered off is solved, ensuring the correctness of the system time and reducing the ECU load, improving product performance and user experience.

CN116149160BActive Publication Date: 2025-06-20JUNSHENG QUNYING (NANJING) NEW ENERGY VEHICLE SYST RES INST CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310031756.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2025-06-20
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

When the charging pile is powered off, the built-in RTC clock module cannot be timed continuously, resulting in the loss of system time and the inability to synchronize network time in time, resulting in abnormal order time and affecting user experience.

Method used

A system time timing method based on vehicle charging piles is adopted. By defining invalid time timing calibration methods, reset timing calibration methods and network time timing methods, RTC is calibrated using multiple time sources to ensure the correctness of the system time, and by optimizing the RTC date and time and UTC time conversion algorithm, the load of the controller ECU is reduced.

Benefits of technology

Effectively ensure the correctness of system time, reduce the load of the controller ECU, improve the performance of charging pile products, and avoid abnormal order time problems caused by time loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116149160B_ABST
    Figure CN116149160B_ABST
Patent Text Reader

Abstract

The present invention discloses a system time timing method based on an in-vehicle charging pile, which specifically includes: S1. According to the mode of the charging pile system time module, corresponding processing is selected. If the mode is the idle mode, then enter S2; if the mode is the time calibration mode, then enter S3; if the mode is the normal mode, then enter S4; S2. In the idle mode, if the system time module is in the on state, set the mode of the system time module to the time calibration mode and return to S1; S3. Enter the time calibration mode; S4. Enter the normal mode; S5. Define a starting year, calculate the total number of seconds before the starting year at one time, and calculate based on the starting year every time the time is converted; S6. Judge whether the year is a leap year; S7. Verify the format of the RTC date and time; S8. Read the RTC date and time; S9. Reset the RTC date and time. The timing method of the present invention can ensure the correctness of the system time while reducing the load of the ECU and improving the performance of the product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automobile electronic technology, and in particular to a system time timing method based on a vehicle-mounted charging pile. Background Art

[0002] With the rapid development of new energy electric vehicles, domestic charging piles have exploded. At the same time, various regions have defined many new requirements for smart charging piles, such as time-based charging, which requires charging piles to have a timing function. However, due to the external input power grid of the charging pile, power may be lost, resulting in the RTC clock module built into the controller ECU being unable to work continuously. Eventually, the RTC timing clock information is lost. If the network cannot be connected in time to synchronize network time, the charging pile system can only restart the timing from the default time, which is inconsistent with the correct time, resulting in abnormal order start time and order end time, causing user complaints.

[0003] Although the charging piles on the market have appeared in the form of controller ECU external hardware RTC, which can provide an independent battery. Even if the charging pile loses power, the RTC can continue to time with battery power and ensure the correctness of the time. However, this will increase the hardware cost of some charging piles, and the battery may be out of power or broken after long-term use, which will make the hardware RTC unable to work properly, and ultimately make the charging pile system timing time error, resulting in abnormal order start time and order end time, which will also cause user complaints and does not fundamentally solve the problem. In addition, the calculation amount of RTC date time and UTC time conversion is relatively large. Therefore, it is urgent to improve the existing algorithm and develop a system time timing method based on the on-board charging pile to solve the system time timing problem, so as to reduce the load of the controller ECU and improve the performance of the product. Summary of the invention

[0004] The purpose of the present invention is to provide a system time timing method based on a vehicle-mounted charging pile. The timing method of the present invention can reduce the load of the controller ECU while ensuring the correctness of the system time, thereby improving the performance of the charging pile product.

[0005] The technical solution of the present invention is a system time timing method based on a vehicle-mounted charging pile, comprising the following steps:

[0006] Step S1, the charging pile system is started, the system time module is set to the on state, and the system time task is executed in the system periodic task; the corresponding processing is selected according to the mode of the charging pile system time module, and the mode of the system time module includes idle mode, time calibration mode and normal mode; if the mode is idle mode, then go to step S2; if the mode is time calibration mode, then go to step S3; if the mode is normal mode, then go to step S4;

[0007] Step S2: In the idle mode, if the system time module is in the enabled state, set the mode of the system time module to the time calibration mode, and return to Step S1;

[0008] Step S3: Enter the time calibration mode. According to the time calibration method, it is processed in three cases: the invalid time calibration method, the reset calibration method, and the network time calibration method;

[0009] Step S4: Enter the normal mode. The tasks include: system time update, determining whether time calibration is required, and periodically storing the system time;

[0010] Step S5: Define a starting year. Calculate the total number of seconds before the starting year at one time when the system starts. When converting time each time, calculate based on the starting year;

[0011] Step S6: Determine whether the year is a leap year;

[0012] Step S7: Verify the format of the RTC date and time;

[0013] Step S8: Read the RTC date and time built into the ECU;

[0014] Step S9: Reset the RTC date and time, convert the system time in seconds into the RTC date and time, then verify the format of the RTC date and time. After passing the verification, directly set the RTC - related registers.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention defines the invalid time calibration method, the reset calibration method, and the network time calibration method. By calibrating the RTC through multiple time sources, it can effectively ensure the correctness of the system time. At the same time, in order not to affect the system performance, the conversion algorithm between the RTC date and time and the UTC time is optimized. By defining a starting year, the total number of seconds before the starting year is calculated at one time. When converting each time, only need to accumulate on this basis, which can effectively reduce the load of the controller ECU and improve the performance of the product.

[0016] In the foregoing system time timing method based on an in - vehicle charging pile, in Step S1, when the charging pile system is initialized, the mode of the system time module is set to the idle mode, and the time calibration method is set to the invalid time calibration method.

[0017] In the foregoing system time timing method based on an in - vehicle charging pile, Step S3 specifically includes the following sub - steps:

[0018] S301. If the time calibration method is an invalid time calibration method, go to step S302; if the time calibration method is a reset calibration method, go to step S310; if the time calibration method is a network time calibration method, go to step S311;

[0019] S302. Read the data in the stored time queue of the EEPROM module, set the query serial number to 0, and go to step S303;

[0020] S303. If the query serial number is less than the maximum serial number of the stored time queue, go to step S304; otherwise, go to step S305;

[0021] S304. Read the stored time data corresponding to the query serial number in the stored time queue of the EEPROM module. If the stored time data is greater than the minimum system configuration time and less than the maximum system configuration time, and the current stored time variable is less than the stored time data, then the current stored time variable is equal to the stored time data, the stored time queue serial number is equal to the query serial number, and the current stored time status is set to 1; the query serial number is incremented by 1, and return to step S303;

[0022] S305. Read the RTC time in seconds and read the ECU reset source. If the ECU reset source is equal to a power-down reset restart or the status of reading the RTC time in seconds is not successful, go to step S306; otherwise, go to step S307;

[0023] S306. Reset the RTC clock module. If the current stored time status is 1, then use the current stored time variable to reset the RTC time, set the RTC calibration time source to the stored time source, set the memory RTC time in seconds to the current stored time, and set the system time to the current stored time; if the current stored time status is not 1, use the minimum system configuration time to reset the RTC time, set the RTC calibration time source to the default time source, set the memory RTC time in seconds to the minimum system configuration time, and set the system time to the minimum system configuration time; go to step S312;

[0024] S307. If the current stored time status is 1, go to step S308; otherwise, go to step S309;

[0025] S308. If the RTC time in seconds is greater than the sum of the current stored time variable and 31536000 or the RTC time in seconds is less than the current stored time variable, then use the current stored time to reset the RTC time, set the RTC calibration time source to the stored time source, set the memory RTC time in seconds to the current stored time, and set the system time to the current stored time; go to step S312;

[0026] S309. If the minimum system configuration time is greater than the RTC time in seconds or the maximum system configuration time is less than the RTC time in seconds, when using the minimum system configuration time to reset the RTC, set the RTC time calibration time source to the default time source, set the remembered RTC time in seconds equal to the minimum system configuration time, and set the system time equal to the minimum system configuration time; proceed to step S312;

[0027] S310. Reset the RTC clock module, then use the system time to reset the RTC time, and proceed to step S312;

[0028] S311. Use the system time to reset the RTC time, and proceed to step S312;

[0029] S312. After the reset is successful, set the mode of the timing authorization module to the normal mode and end.

[0030] In the foregoing system time timing method based on an in-vehicle charging pile, step S4 specifically includes the following sub-steps:

[0031] S401. In the task with a period of 1 second, increment the 1-minute timer by 1, and then assign the obtained network time return status to the network time update status; if the network time update status is 1, proceed to step S402; if the network time update status is 0, proceed to step S406;

[0032] S402. If the 1-minute timer is greater than or equal to 60 seconds or the RTC time calibration time source is not equal to the network time source, read the RTC time in seconds; if the status of reading the RTC time in seconds is successful, proceed to step S403; if the status of reading the RTC time in seconds is failed, set the mode of the system time module to the calibration mode, set the time calibration method to the reset calibration method, and proceed to step S404;

[0033] S403. If the RTC time in seconds is greater than the network time, the absolute value of time is equal to the RTC time in seconds minus the network time; otherwise, the absolute value of time is equal to the network time minus the RTC time in seconds; if the absolute value of time is greater than the RTC calibration minimum time threshold, set the mode of the system time module to the calibration mode, set the time calibration method to the network time calibration method; proceed to step S404;

[0034] S404. If the RTC time calibration time source is not equal to the network time source, set the RTC time calibration time source to the network time source; if the system time is greater than the network time, the absolute value of the time is equal to the system time minus the network time, and set the network time calibration direction to network time calibration decrease; otherwise, the absolute value of the time is equal to the network time minus the system time, and set the network time calibration direction to network time calibration increase; if the absolute value of the time is greater than the minimum time threshold for system time calibration, then set the periodic storage timer equal to the storage interval time, and set the 1-minute timer equal to 60 seconds; proceed to step S405;

[0035] S405. Set the system time equal to the network time, and set the offline timer to 0; proceed to step S410;

[0036] S406. If the 1-minute timer is greater than or equal to 60 seconds, then proceed to step S407; otherwise, proceed to step S410;

[0037] S407. Read the RTC time in seconds. If the status of reading the RTC time in seconds is successful, then proceed to step S408; if the status of reading the RTC time in seconds is failed, then set the mode of the system time module to the time calibration mode, set the time calibration method to the reset calibration method, and proceed to step S409;

[0038] S408. If the RTC time in seconds is greater than or equal to the sum of the memory RTC time in seconds and the 1-minute minimum threshold and the RTC time in seconds is less than the sum of the memory RTC time in seconds and the 1-minute maximum threshold, then the system time is equal to the RTC time in seconds; otherwise, set the mode of the system time module to the time calibration mode, set the time calibration method to the reset calibration method; proceed to step S409;

[0039] S409. Increment the offline timer by 1. If the offline timer is greater than or equal to the offline timeout time threshold, then set the RTC time calibration time source to the system time source, set the offline timer to 0; proceed to step S410;

[0040] S410. If the 1-minute timer is greater than or equal to 60 seconds, set the memory RTC time in seconds equal to the RTC time in seconds, set the 1-minute timer to 0, and increment the periodic storage timer by 1; if the periodic storage timer is greater than or equal to the storage interval time, then store the current system time at the address corresponding to the current storage time queue sequence number, increment the storage time queue sequence number by 1, set the periodic storage timer equal to 0; if the storage time queue sequence number is greater than or equal to the maximum number of the storage time queue, then set the storage time queue sequence number to 0; proceed to step S411;

[0041] S411. If the system time module is in the closed state, then set the mode of the system time module to the idle mode; proceed to step S412;

[0042] S412. End.

[0043] In the above-mentioned system time timing method based on an in-vehicle charging pile, the step S5 specifically includes the following sub-steps:

[0044] S501. Define a starting year. When the system starts, calculate the total number of seconds in a non-leap year as 31536000, set the year number equal to 1970, set the total historical seconds from 1970 as 0, and enter step S502;

[0045] S502. Determine whether the year number is less than the starting year. If it is satisfied, enter step S503; if not, enter step S504;

[0046] S503. The total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 31536000. Then determine whether the year corresponding to the year number is a leap year. If it is a leap year, the total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 86400; then increment the year number by 1 and return to step S502;

[0047] S504. Complete the calculation of the total historical seconds starting from 1970.

[0048] In the above-mentioned system time timing method based on an in-vehicle charging pile, the step S6 specifically includes: First, take the remainder of the year by 4. If it is greater than 0, it means it is not an integer multiple of 4, so it is not a leap year; if it is equal to 0, it means the year is an integer multiple of 4. Then take the remainder of the year by 100. If it is greater than 0, it means the year is not an integer multiple of 100, so it is a leap year. If it is equal to 0, it means the year is an integer multiple of 100. Then continue to take the remainder of the year by 400. If it is equal to 0, it means the year is an integer multiple of 400, so it is a leap year; otherwise, it is not a leap year.

[0049] In the above-mentioned system time timing method based on an in-vehicle charging pile, the step S7 specifically includes the following sub-steps:

[0050] S701. Define two arrays. The first array is the number of days in each month of a non-leap year, and the second array is the cumulative number of days in each month of a non-leap year; First, calculate the maximum number of days in the current month. If the month of the RTC date and time is equal to 2 and the year of the RTC date and time is a leap year, then the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non-leap year monthly days array plus 1; otherwise, the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non-leap year monthly days array; enter step S702;

[0051] S702. Determine whether the year of the RTC date and time is greater than or equal to the starting year. If it is satisfied, go to step S703; otherwise, the verification fails and go to step S706;

[0052] S703. Determine whether the month of the RTC date and time is greater than or equal to 1 and less than or equal to 12. If it is satisfied, go to step S704; otherwise, the verification fails and go to step S706;

[0053] S704. Determine whether the day of the RTC date and time is greater than or equal to 1 and less than or equal to the maximum number of days in this month. If it is satisfied, go to step S705; otherwise, the verification fails and go to step S706;

[0054] S705. If the hour of the RTC date and time is less than 24, the minute of the RTC date and time is less than 60, and the second of the RTC date and time is less than 60, the verification is successful; otherwise, the verification fails; go to step S706;

[0055] S706. End.

[0056] In the foregoing system time timing method based on an in-vehicle charging pile, the step S8 specifically includes the following sub-steps:

[0057] S801. First, set the status of reading the RTC time to failed, then read the RTC date and time built in the ECU, and then verify the format of the RTC date and time. If the verification is successful, go to step S802; otherwise, go to step S806;

[0058] S802. Calculate the RTC time seconds according to the year. The calculation formula is: RTC time seconds = total historical seconds from 1970 + (year of the RTC date and time - starting year) * 31536000, and then set the year serial number equal to the starting year, and go to step S803;

[0059] S803. Determine whether the year serial number is less than the year of the RTC date and time. If it is satisfied, go to step S804; if it is not satisfied, go to step S805;

[0060] S804. Determine whether the year corresponding to the year serial number is a leap year. If it is a leap year, RTC time seconds = RTC time seconds + 86400; then add 1 to the year serial number and return to step S803;

[0061] S805. Determine whether the current year is a leap year and whether the month is greater than 2. If the year of the RTC date and time is a leap year and the month of the RTC date and time is greater than 2, then RTC time seconds = RTC time seconds + 86400; Obtain the cumulative number of days corresponding to the month of the current RTC date and time according to the array of cumulative days per month in a non - leap year, and then calculate RTC time seconds: RTC time seconds = RTC time seconds + the cumulative number of days corresponding to the month of the RTC date and time * 86400; Then calculate the number of seconds corresponding to the number of days in this month, calculate RTC time seconds: RTC time seconds = RTC time seconds + (the day of the RTC date and time - 1) * 86400; Then calculate the seconds corresponding to hours, minutes, and seconds, calculate RTC time seconds: RTC time seconds = RTC time seconds + the hour of the RTC date and time * 3600 + the minute of the RTC date and time * 60 + the second of the RTC date and time, and set the status of reading the RTC time to successful; Proceed to step S806;

[0062] S806. Return the status of reading the RTC time and end.

[0063] In the foregoing method for timing the system time based on an in - vehicle charging pile, step S9 specifically includes the following sub - steps:

[0064] S901. First, set an initial value for the year of the RTC date and time. The year of the RTC date and time is equal to the starting year. Then calculate all seconds: All seconds = System time seconds - the total historical seconds from 1970; Then calculate all days and the remaining seconds: All days = All seconds / 86400, Remaining seconds = All seconds % 86400; Then calculate the hour of the RTC date and time and the remaining seconds: The hour of the RTC date and time = Remaining seconds / 3600, Remaining seconds = Remaining seconds % 3600; Then calculate the minute of the RTC date and time and the second of the RTC date and time: The minute of the RTC date and time = Remaining seconds / 60, The second of the RTC date and time = Remaining seconds % 60; Then calculate the number of days in a year. If the year of the RTC date and time is a leap year, then the number of days in a year is equal to 366. Otherwise, the number of days in a year is equal to 365; Proceed to step S902;

[0065] S902. If all days are greater than or equal to the number of days in a year, then proceed to step S903; Otherwise, proceed to step S904;

[0066] S903. Increment the year of the RTC date and time by 1, All days = All days - the number of days in a year, and then calculate the number of days in a year. If the year of the RTC date and time is a leap year, then the number of days in a year is equal to 366. Otherwise, the number of days in a year is equal to 365; Return to step S902;

[0067] S904. All days = all days + 1, then calculate the month of the RTC date and time, set the loop sequence number to 1, and go to step S905;

[0068] S905. If the loop sequence number is less than or equal to 12, go to step S906; otherwise, go to step S907;

[0069] S906. Calculate the number of days in a month. The number of days in a month is equal to the number of days corresponding to the loop sequence number in the array of the number of days in each month of a non - leap year. If the loop sequence number is 2 and the year of the RTC date and time is a leap year, then the number of days in a month is increased by 1; if all days are less than or equal to the number of days in a month, the month of the RTC date and time is equal to the loop sequence number, go to step S907; otherwise, all days = all days - the number of days in a month, the loop sequence number is increased by 1, and return to step S905;

[0070] S907. The day of the RTC date and time is equal to all days, then check the format of the calculated RTC date and time. If the check is successful, directly use the RTC date and time to set the RTC - related registers, and set the reset RTC date and time status to success; if the check fails, set the reset RTC date and time status to failure; go to step S908;

[0071] S908. End. Description of the Drawings

[0072] Figure 1 is the flowchart of the operation of the present invention. Detailed Embodiment

[0073] The present invention will be further described below with reference to the drawings and embodiments, but it shall not be used as a basis for limiting the present invention.

[0074] Embodiment: A system time timing method based on an in - vehicle charging pile, the operation process is as Figure 1 shown, including the following steps:

[0075] Step S1. When the charging pile system is initialized, set the mode of the system time module to the idle mode, and set the time calibration method to the invalid time calibration method. When the charging pile system starts, set the system time module to the on state, and the system time task is executed in the system 1 - second cycle task; according to the mode of the charging pile system time module, select the corresponding processing. The modes of the system time module include the idle mode, the calibration mode, and the normal mode; if the mode is the idle mode, go to step S2; if the mode is the calibration mode, go to step S3; if the mode is the normal mode, go to step S4.

[0076] Step S2. In the idle mode, if the system time module is in the on state, set the mode of the system time module to the calibration mode, and return to step S1.

[0077] Step S3: Enter the time calibration mode, and process it in three cases according to the time calibration method, namely the invalid time calibration method, the reset calibration method, and the network time calibration method.

[0078] Step S3 specifically includes the following sub-steps:

[0079] S301: If the time calibration method is the invalid time calibration method, go to step S302; if the time calibration method is the reset calibration method, go to step S310; if the time calibration method is the network time calibration method, go to step S311;

[0080] S302: Read the data in the stored time queue of the EEPROM module, set the query serial number to 0, and go to step S303;

[0081] S303: If the query serial number is less than the maximum serial number of the stored time queue, go to step S304; otherwise, go to step S305;

[0082] S304: Read the stored time data corresponding to the query serial number in the stored time queue of the EEPROM module. If the stored time data is greater than the minimum system configuration time and less than the maximum system configuration time, and the current stored time variable is less than the stored time data, then the current stored time variable is equal to the stored time data, the stored time queue serial number is equal to the query serial number, and the current stored time status is set to 1; the query serial number is incremented by 1, and return to step S303;

[0083] S305: Read the RTC time in seconds and read the ECU reset source. If the ECU reset source is equal to power-off reset restart or the status of reading the RTC time in seconds is not successful, go to step S306; otherwise, go to step S307;

[0084] S306: Reset the RTC clock module. If the current stored time status is 1, then use the current stored time variable to reset the RTC time, set the RTC calibration time source to the stored time source, set the memory RTC time in seconds to the current stored time, and set the system time to the current stored time; if the current stored time status is not 1, use the minimum system configuration time to reset the RTC time, set the RTC calibration time source to the default time source, set the memory RTC time in seconds to the minimum system configuration time, and set the system time to the minimum system configuration time; go to step S312;

[0085] S307: If the current stored time status is 1, go to step S308; otherwise, go to step S309;

[0086] S308. If the RTC time in seconds is greater than the sum of the current stored time variable and 31536000 (the number of seconds in one year) or the RTC time in seconds is less than the current stored time variable, then reset the RTC time using the current stored time, set the RTC time calibration time source to the stored time source, set the memorized RTC time in seconds to the current stored time, and set the system time to the current stored time; proceed to step S312;

[0087] S309. If the system configuration minimum time is greater than the RTC time in seconds or the system configuration maximum time is less than the RTC time in seconds, then reset the RTC time using the system configuration minimum time, set the RTC time calibration time source to the default time source, set the memorized RTC time in seconds to the system configuration minimum time, and set the system time to the system configuration minimum time; proceed to step S312;

[0088] S310. Reset the RTC clock module, and then reset the RTC time using the system time, and proceed to step S312;

[0089] S311. Reset the RTC time using the system time, and proceed to step S312;

[0090] S312. After the reset is successful, set the mode of the timing authorization module to the normal mode, and end.

[0091] Configuration items: The system configuration minimum time can be configured through macro definition, and the default value is UTC time 1640970061 (Beijing time: January 1, 2022, 1:01:01); the system configuration maximum time can be configured through macro definition, and the default value is UTC time 2524582861 (Beijing time: January 1, 2050, 1:01:01); the maximum number of the stored time queue can be configured through macro definition, and the default value is 6.

[0092] Step S4. Enter the normal mode, and the tasks include: system time update, determining whether time calibration is required, and periodically storing the system time.

[0093] Step S4 specifically includes the following sub-steps:

[0094] S401. In the task with a period of 1 second, increment the 1-minute timer by 1, and then assign the status of obtaining the network time to the network time update status; if the network time update status is 1, then proceed to step S402; if the network time update status is 0, then proceed to step S406;

[0095] S402. If the 1-minute timer is greater than or equal to 60 seconds or the RTC time calibration time source is not equal to the network time source, then read the RTC time in seconds; if the status of reading the RTC time in seconds is successful, proceed to step S403; if the status of reading the RTC time in seconds is failed, set the mode of the system time module to the time calibration mode, set the time calibration method to the reset calibration method, and proceed to step S404;

[0096] S403. If the RTC time in seconds is greater than the network time, then the absolute time is equal to the RTC time in seconds minus the network time; otherwise, the absolute time is equal to the network time minus the RTC time in seconds; if the absolute time is greater than the RTC calibration minimum time threshold, set the mode of the system time module to the time calibration mode, set the time calibration method to the network time calibration method; proceed to step S404;

[0097] S404. If the RTC time calibration time source is not equal to the network time source, set the RTC time calibration time source to the network time source; if the system time is greater than the network time, the absolute time is equal to the system time minus the network time, set the network calibration direction to network calibration decrease; otherwise, the absolute time is equal to the network time minus the system time, set the network calibration direction to network calibration increase; if the absolute time is greater than the system calibration minimum time threshold, set the periodic storage timer equal to the storage interval time, set the 1-minute timer equal to 60 seconds; proceed to step S405;

[0098] S405. Set the system time equal to the network time, set the offline timer to 0; proceed to step S410;

[0099] S406. If the 1-minute timer is greater than or equal to 60 seconds, then proceed to step S407; otherwise, proceed to step S410;

[0100] S407. Read the RTC time in seconds, if the status of reading the RTC time in seconds is successful, proceed to step S408; if the status of reading the RTC time in seconds is failed, set the mode of the system time module to the time calibration mode, set the time calibration method to the reset calibration method, and proceed to step S409;

[0101] S408. If the RTC time in seconds is greater than or equal to the sum of the memory RTC time in seconds and the 1-minute minimum threshold and the RTC time in seconds is less than the sum of the memory RTC time in seconds and the 1-minute maximum threshold, then the system time is equal to the RTC time in seconds; otherwise, set the mode of the system time module to the time calibration mode, set the time calibration method to the reset calibration method; proceed to step S409;

[0102] S409. Increment the offline timer by 1. If the offline timer is greater than or equal to the offline timeout time threshold, set the RTC calibration time source to the system time source, set the offline timer to 0, and proceed to step S410.

[0103] S410. If the 1-minute timer is greater than or equal to 60 seconds, set the memory RTC time seconds equal to the RTC time seconds, set the 1-minute timer to 0, and increment the periodic storage timer by 1. If the periodic storage timer is greater than or equal to the storage interval time, store the current system time at the address corresponding to the current storage time queue sequence number, increment the storage time queue sequence number by 1, set the periodic storage timer to 0. If the storage time queue sequence number is greater than or equal to the maximum number of the storage time queue, set the storage time queue sequence number to 0, and proceed to step S411.

[0104] S411. If the system time module is in the off state, set the mode of the system time module to the idle mode, and proceed to step S412.

[0105] S412. End.

[0106] Configuration items: The storage interval time can be configured through macro definition, and the default value is 30 (30 minutes); the minimum threshold of 1 minute can be configured through macro definition, and the default value is 30 (30 seconds); the maximum threshold of 1 minute can be configured through macro definition, and the default value is 90 (90 seconds); the minimum time threshold for RTC calibration can be configured through macro definition, and the default value is 5 (5 seconds); the minimum time threshold for system calibration can be configured through macro definition, and the default value is 30 (30 seconds); the offline timeout time threshold can be configured through macro definition, and the default value is 1440 (24 hours).

[0107] Step S5: The international UTC time is the time accumulated in seconds starting from 1970. If it starts from 1970 every time the time is converted, the calculation amount will be very large. The present invention defines a starting year, and calculates the total number of seconds before the starting year at one time when the system starts. Every time the time is converted, only the calculation needs to be performed based on the starting year. For the convenience of calculation, two arrays need to be defined. The first array is the number of days in each month of a non-leap year, with 13 values. The numerical range of the month is from 1 to 12, and the corresponding number of days in each month is 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, and 31 respectively. The second array is the cumulative number of days in each month of a non-leap year, excluding the days of this month, with 13 values. The corresponding cumulative number of days in each month is 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, and 334 respectively.

[0108] Step S5 specifically includes the following sub-steps:

[0109] S501. Define a starting year, which is the current year value, such as 2022. Then calculate the total number of seconds in a day, which is 24 * 60 * 60, and the calculated total number of seconds in a day is 86400. Then calculate the total number of seconds in a non - leap year, which is 365 * 86400, and the calculated total number of seconds in a non - leap year is 31536000. Set the year number equal to 1970, set the total historical seconds from 1970 to 0, and enter step S502;

[0110] S502. Determine whether the year number is less than the starting year. If it is satisfied, enter step S503; if not, enter step S504;

[0111] S503. The total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 31536000. Then determine whether the year corresponding to the year number is a leap year. If it is a leap year, the total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 86400; then increment the year number by 1 and return to step S502;

[0112] S504. Complete the calculation of the total historical seconds starting from 1970.

[0113] Step S6. Determine whether the year is a leap year. First, take the remainder of the year divided by 4. If it is greater than 0, it means it is not an integer multiple of 4, so it is not a leap year; if it is equal to 0, it means the year is an integer multiple of 4. Then take the remainder of the year divided by 100. If it is greater than 0, it means the year is not an integer multiple of 100, so it is a leap year; if it is equal to 0, it means the year is an integer multiple of 100. Then continue to take the remainder of the year divided by 400. If it is equal to 0, it means the year is an integer multiple of 400, so it is a leap year; otherwise, it is not a leap year.

[0114] Step S7. Check the format of the RTC date and time. When the RTC module reads the RTC time, it needs to check the relevant data. After passing the check, convert the RTC time to RTC time seconds and return a successful read. Similarly, when the RTC module resets and writes the RTC time, it needs to convert the system time to RTC time and check the relevant data. After passing the check, write the RTC time to the RTC register address. The specific logic is as follows:

[0115] S701. First, calculate the maximum number of days in the current month. If the month of the RTC date and time is equal to 2 and the year of the RTC date and time is a leap year, then the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non - leap - year monthly - days array plus 1; otherwise, the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non - leap - year monthly - days array; enter step S702;

[0116] S702. Determine whether the year of the RTC date and time is greater than or equal to the starting year. If it is satisfied, proceed to step S703; otherwise, the verification fails and proceed to step S706;

[0117] S703. Determine whether the month of the RTC date and time is greater than or equal to 1 and less than or equal to 12. If it is satisfied, proceed to step S704; otherwise, the verification fails and proceed to step S706;

[0118] S704. Determine whether the day of the RTC date and time is greater than or equal to 1 and less than or equal to the maximum number of days in this month. If it is satisfied, proceed to step S705; otherwise, the verification fails and proceed to step S706;

[0119] S705. If the hour of the RTC date and time is less than 24, the minute of the RTC date and time is less than 60, and the second of the RTC date and time is less than 60, the verification is successful; otherwise, the verification fails; proceed to step S706;

[0120] S706. End.

[0121] Step S8. Read the RTC time. It is necessary to read out the RTC date and time built in the ECU and convert it into RTC time seconds after the verification passes. The main steps are as follows:

[0122] S801. First, set the status of reading the RTC time as failed, then read the RTC date and time built in the ECU, and then verify the format of the RTC date and time (year, month, day, hour, minute, and second). Verify according to the above verification method. If the verification is successful, proceed to step S802; otherwise, proceed to step S806;

[0123] S802. Calculate the RTC time seconds according to the year. The calculation formula is: RTC time seconds = total historical seconds from 1970 + (year of the RTC date and time - starting year) * 31536000. Then set the year serial number equal to the starting year and proceed to step S803;

[0124] S803. Determine whether the year serial number is less than the year of the RTC date and time. If it is satisfied, proceed to step S804; if it is not satisfied, proceed to step S805;

[0125] S804. Determine whether the year corresponding to the year serial number is a leap year. If it is a leap year, one more day needs to be added due to the leap year, so RTC time seconds = RTC time seconds + 86400; then increment the year serial number by 1 and return to step S803;

[0126] S805. Determine whether the current year is a leap year and whether the month is greater than 2. If the year of the RTC date and time is a leap year and the month of the RTC date and time is greater than 2, then add one day's worth of seconds to the RTC time seconds, i.e., RTC time seconds = RTC time seconds + 86400; obtain the cumulative number of days corresponding to the month of the current RTC date and time according to the array of cumulative days per month for non - leap years, and then calculate the RTC time seconds: RTC time seconds = RTC time seconds + the cumulative number of days corresponding to the month of the RTC date and time * 86400; then calculate the seconds corresponding to the number of days in this month, calculate the RTC time seconds: RTC time seconds = RTC time seconds + (the day of the RTC date and time - 1) * 86400; then calculate the seconds corresponding to hours, minutes, and seconds, calculate the RTC time seconds: RTC time seconds = RTC time seconds + the hour of the RTC date and time * 3600 + the minute of the RTC date and time * 60 + the second of the RTC date and time, and set the status of reading the RTC time to successful; proceed to step S806;

[0127] S806. Return the status of reading the RTC time and end.

[0128] Step S9. Reset the RTC date and time, convert the system time seconds into the RTC date and time, and then verify the format of the RTC date and time. After passing the verification, directly set the RTC - related registers.

[0129] Step S9 specifically includes the following sub - steps:

[0130] S901. First, set the initial value for the year of the RTC date and time. The year of the RTC date and time is equal to the starting year. Then calculate all the seconds, and the calculation formula is: all seconds = system time seconds - the total historical seconds from 1970; then calculate all the days and the remaining seconds, and the calculation formulas are: all days = all seconds / 86400, remaining seconds = all seconds % 86400; then calculate the hour of the RTC date and time and the remaining seconds, and the calculation formula is: the hour of the RTC date and time = remaining seconds / 3600, remaining seconds = remaining seconds % 3600; then calculate the minute of the RTC date and time and the second of the RTC date and time, and the calculation formulas are: the minute of the RTC date and time = remaining seconds / 60, the second of the RTC date and time = remaining seconds % 60; then calculate the number of days in a year. If the year of the RTC date and time is a leap year, then the number of days in a year is equal to 366; otherwise, the number of days in a year is equal to 365; proceed to step S902;

[0131] S902. If all days are greater than or equal to the number of days in a year, then proceed to step S903; otherwise, proceed to step S904;

[0132] S903. Increment the year of the RTC date and time by 1. Set all days = all days - the number of days in a year. Then calculate the number of days in a year. If the year of the RTC date and time is a leap year, the number of days in a year is equal to 366; otherwise, the number of days in a year is equal to 365. Return to step S902;

[0133] S904. Set all days = all days + 1. Then calculate the month of the RTC date and time. Set the loop sequence number to 1 and enter step S905;

[0134] S905. If the loop sequence number is less than or equal to 12, enter step S906; otherwise, enter step S907;

[0135] S906. Calculate the number of days in a month. The number of days in a month is equal to the number of days corresponding to the loop sequence number in the array of days in each month of a non - leap year. If the loop sequence number is 2 and the year of the RTC date and time is a leap year, increment the number of days in a month by 1. If all days is less than or equal to the number of days in a month, set the month of the RTC date and time to the loop sequence number and enter step S907; otherwise, set all days = all days - the number of days in a month, increment the loop sequence number by 1, and return to step S905;

[0136] S907. Set the day of the RTC date and time to all days. Then perform a verification on the calculated RTC date and time format (year, month, day, hour, minute, and second). Perform the verification according to the above verification method. If the verification is successful, directly use the RTC date and time to set the RTC - related registers and set the reset RTC date and time status to successful; if the verification fails, set the reset RTC date and time status to failed. Enter step S908;

[0137] S908. End.

[0138] The above is only the preferred embodiment of the present invention. The protection scope of the present invention is not limited to the above - mentioned embodiments. All technical solutions falling within the idea of the present invention belong to the protection scope of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements should also be regarded as within the protection scope of the present invention.

Claims

1. A system time timing method based on an in-vehicle charging pile, characterized in that: It includes the following steps: Step S1: The charging pile system starts, sets the system time module to the on state, and the system time task is executed in the system periodic task; According to the mode of the charging pile system time module, corresponding processing is selected. The modes of the system time module include the idle mode, the time calibration mode, and the normal mode; if the mode is the idle mode, go to step S2; if the mode is the time calibration mode, go to step S3; if the mode is the normal mode, go to step S4; Step S2: In the idle mode, if the system time module is in the on state, set the mode of the system time module to the time calibration mode, and return to step S1; Step S3: Enter the time calibration mode, and process according to three cases of the invalid time calibration method, the reset time calibration method, and the network time calibration method; Step S4: Enter the normal mode, and the tasks include: system time update, determining whether time calibration is required, and periodically storing the system time; Step S5: Define a starting year, calculate the total number of seconds before the starting year at one time when the system starts, and calculate based on the starting year every time time conversion occurs; Step S7: Judge whether the year is a leap year; Step S8: Verify the format of the RTC date and time; Step S9: Read the RTC date and time built in the ECU; Step S9 includes the following sub-steps: S901: First, set the initial value of the year of the RTC date and time. The year of the RTC date and time is equal to the starting year, then calculate all seconds, then calculate all days and the remaining seconds, then calculate the hours of the RTC date and time and the remaining seconds, then calculate the minutes of the RTC date and time and the seconds of the RTC date and time, and then calculate the number of days in a year. If the year of the RTC date and time is a leap year, the number of days in a year is equal to 366, otherwise, the number of days in a year is equal to 365; go to step S902; S902: If all days are greater than or equal to the number of days in a year, go to step S903; otherwise, go to step S904; S903: Add 1 to the year of the RTC date and time, all days = all days - the number of days in a year, and then calculate the number of days in a year; return to step S902; S904: All days = all days + 1, then calculate the month of the RTC date and time, set the loop serial number to 1, and go to step S905; S905: If the loop serial number is less than or equal to 12, go to step S906; otherwise, go to step S907; S906: Calculate the number of days in a month. The number of days in a month is equal to the number of days corresponding to the loop serial number in the array of the number of days in each month of a non - leap year. If the loop serial number is 2 and the year of the RTC date and time is a leap year, add 1 to the number of days in a month; if all days are less than or equal to the number of days in a month, the month of the RTC date and time is equal to the loop serial number, go to step S907; otherwise, all days = all days - the number of days in a month, the loop serial number is incremented by 1, and return to step S905; S907. If the day of the RTC date and time is equal to all days, then verify the calculated RTC date and time format. If the verification is successful, directly use the RTC date and time to set the RTC-related registers, and set the reset RTC date and time status to success; if the verification fails, set the reset RTC date and time status to failure; proceed to step S908. S908. End.

2. The system time timing method based on an in-vehicle charging pile according to claim 1, characterized in that: In step S1, when initializing the charging pile system, set the mode of the system time module to the idle mode and set the time calibration method to the invalid time calibration method.

3. The system time timing method based on an in-vehicle charging pile according to claim 1, characterized in that: Step S3 specifically includes the following sub-steps: S301. If the time calibration method is the invalid time calibration method, proceed to step S302; if the time calibration method is the reset calibration method, proceed to step S310; if the time calibration method is the network time calibration method, proceed to step S311. S302. Read the data in the stored time queue in the EEPROM module, set the query serial number to 0, and proceed to step S303. S303. If the query serial number is less than the maximum serial number of the stored time queue, proceed to step S304. Otherwise, proceed to step S305. S304. Read the stored time data corresponding to the query serial number in the stored time queue in the EEPROM module. If the stored time data is greater than the minimum system configuration time and less than the maximum system configuration time, and the current stored time variable is less than the stored time data, then the current stored time variable is equal to the stored time data, the stored time queue serial number is equal to the query serial number, and set the current stored time status to 1; increment the query serial number by 1, and return to step S303. S305. Read the RTC time in seconds and read the ECU reset source. If the ECU reset source is equal to power-down reset restart or the status of reading the RTC time in seconds is not successful, proceed to step S306. Otherwise, proceed to step S307. S306. Reset the RTC clock module. If the current stored time status is 1, then use the current stored time variable to reset the RTC time, set the RTC calibration time source to the stored time source, set the memory RTC time in seconds to the current stored time, and set the system time to the current stored time; If the current stored time status is not 1, use the minimum system configuration time to reset the RTC time, set the RTC calibration time source to the default time source, set the memory RTC time in seconds to the minimum system configuration time, and set the system time to the minimum system configuration time; proceed to step S312. S307. If the current stored time status is 1, proceed to step S308; otherwise, proceed to step S309. S308. If the RTC time in seconds is greater than the sum of the current stored time variable and 31536000 or the RTC time in seconds is less than the current stored time variable, then use the current stored time to reset the RTC time, set the RTC calibration time source to the stored time source, set the memory RTC time in seconds to the current stored time, and set the system time to the current stored time; Proceed to step S312. S309. If the minimum system configuration time is greater than the RTC time in seconds or the maximum system configuration time is less than the RTC time in seconds, when using the minimum system configuration time to reset the RTC, set the RTC calibration time source to the default time source, set the memorized RTC time in seconds equal to the minimum system configuration time, and set the system time equal to the minimum system configuration time; go to step S312; S310. Reset the RTC clock module, then use the system time to reset the RTC time, and go to step S312; S311. Use the system time to reset the RTC time, and go to step S312; S312. After successful reset, set the mode of the timing authorization module to the normal mode and end.

4. A method for timing the system time based on an in-vehicle charging pile according to claim 3, wherein: The specific steps of step S4 include the following sub-steps: S401. In the task with a period of 1 second, increment the 1-minute timer by 1, and then assign the network time return status to the network time update status; if the network time update status is 1, go to step S402; if the network time update status is 0, go to step S406; S402. If the 1-minute timer is greater than or equal to 60 seconds or the RTC calibration time source is not equal to the network time source, read the RTC time in seconds; If the status of reading the RTC time in seconds is successful, go to step S403; if the status of reading the RTC time in seconds is failed, set the mode of the system time module to the calibration mode, set the time calibration method to the reset calibration method, and go to step S404; S403. If the RTC time in seconds is greater than the network time, the absolute value of time is equal to the RTC time in seconds minus the network time; otherwise, the absolute value of time is equal to the network time minus the RTC time in seconds; if the absolute value of time is greater than the RTC calibration minimum time threshold, set the mode of the system time module to the calibration mode and set the time calibration method to the network time calibration method; Go to step S404; S404. If the RTC calibration time source is not equal to the network time source, set the RTC calibration time source to the network time source; if the system time is greater than the network time, the absolute value of time is equal to the system time minus the network time, and set the network calibration direction to network calibration decrease; otherwise, the absolute value of time is equal to the network time minus the system time, and set the network calibration direction to network calibration increase; if the absolute value of time is greater than the system calibration minimum time threshold, set the periodic storage timer equal to the storage interval time and set the 1-minute timer equal to 60 seconds; Go to step S405; S405. Set the system time equal to the network time and set the offline timer to 0; Go to step S410; S406. If the 1-minute timer is greater than or equal to 60 seconds, go to step S407; Otherwise, go to step S410; S407. Read the RTC time in seconds. If the status of reading the RTC time in seconds is successful, go to step S408; if the status of reading the RTC time in seconds is failed, set the mode of the system time module to the calibration mode, set the time calibration method to the reset calibration method, and go to step S409; S408. If the RTC time in seconds is greater than or equal to the sum of the memorized RTC time in seconds and the minimum threshold of 1 minute and less than the sum of the memorized RTC time in seconds and the maximum threshold of 1 minute, then the system time is equal to the RTC time in seconds; Otherwise, set the mode of the system time module to the time calibration mode, and set the time calibration method to the reset calibration method; go to step S409; S409. Increment the offline timer by 1. If the offline timer is greater than or equal to the offline timeout threshold, then set the RTC calibration time source to the system time source and set the offline timer to 0; Go to step S410; S410. If the 1-minute timer is greater than or equal to 60 seconds, set the memorized RTC time in seconds equal to the RTC time in seconds, set the 1-minute timer to 0, and increment the periodic storage timer by 1. If the periodic storage timer is greater than or equal to the storage interval time, then store the current system time at the address corresponding to the current storage time queue sequence number, increment the storage time queue sequence number by 1, and set the periodic storage timer to 0. If the storage time queue sequence number is greater than or equal to the maximum number of the storage time queue, then set the storage time queue sequence number to 0; go to step S411; S411. If the system time module is in the off state, then set the mode of the system time module to the idle mode; go to step S412; S412. End.

5. A method for timing the system time based on an in-vehicle charging pile according to claim 4, wherein: The step S5 specifically includes the following sub-steps: S501. Define a starting year. When the system starts, calculate that the total number of seconds in a non-leap year is 31536000, set the year sequence number equal to 1970, set the total historical seconds from 1970 to 0, and go to step S502; S502. Determine whether the year sequence number is less than the starting year. If it is satisfied, then go to step S503; if not, then go to step S504; S503. The total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 31536000. Then determine whether the year corresponding to the year sequence number is a leap year. If it is a leap year, then the total historical seconds from 1970 is equal to the total historical seconds from 1970 plus 86400. Then increment the year sequence number by 1 and return to step S502; S504. Complete the calculation of the total historical seconds starting from 1970.

6. A method for timing the system time based on an in-vehicle charging pile according to claim 5, wherein: The step S6 specifically includes: First, take the remainder of the year by 4. If it is greater than 0, it means it is not an integer multiple of 4, so it is not a leap year; if it is equal to 0, it means the year is an integer multiple of 4. Then take the remainder of the year by 100. If it is greater than 0, it means the year is not an integer multiple of 100, so it is a leap year. If it is equal to 0, it means the year is an integer multiple of 100. Then continue to take the remainder of the year by 400. If it is equal to 0, it means the year is an integer multiple of 400, so it is a leap year. Otherwise, it is not a leap year.

7. A method for timing the system time based on an in-vehicle charging pile according to claim 6, wherein: The step S7 specifically includes the following sub-steps: S701. Define two arrays. The first array is the number of days in each month of a non - leap year, and the second array is the cumulative number of days in each month of a non - leap year. First, calculate the maximum number of days in the current month. If the month of the RTC date and time is equal to 2 and the year of the RTC date and time is a leap year, then the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non - leap - year monthly - days array plus 1. Otherwise, the maximum number of days in this month is equal to the number of days corresponding to the month of the RTC date and time in the non - leap - year monthly - days array. Proceed to step S702; S702. Determine whether the year of the RTC date and time is greater than or equal to the starting year. If it is satisfied, proceed to step S703; otherwise, the verification fails and proceed to step S706; S703. Determine whether the month of the RTC date and time is greater than or equal to 1 and less than or equal to 12. If it is satisfied, proceed to step S704; otherwise, the verification fails and proceed to step S706; S704. Determine whether the day of the RTC date and time is greater than or equal to 1 and less than or equal to the maximum number of days in this month. If it is satisfied, proceed to step S705; otherwise, the verification fails and proceed to step S706; S705. If the hour of the RTC date and time is less than 24, the minute of the RTC date and time is less than 60, and the second of the RTC date and time is less than 60, then the verification is successful; otherwise, the verification fails. Proceed to step S706; S706. End.

8. A method for timing the system time based on an in-vehicle charging pile according to claim 7, wherein: The specific steps of step S8 include the following sub - steps: S801. First, set the status of reading the RTC time to failed, then read the RTC date and time built - in in the ECU, and then verify the format of the RTC date and time. If the verification is successful, proceed to step S802; Otherwise, proceed to step S806; S802. Calculate the RTC time in seconds according to the year. The calculation formula is: RTC time in seconds = total seconds from 1970 + (year of the RTC date and time - starting year) * 31536000. Then set the year number equal to the starting year and proceed to step S803; S803. Determine whether the year number is less than the year of the RTC date and time. If it is satisfied, proceed to step S804; if not, proceed to step S805; S804. Determine whether the year corresponding to the year number is a leap year. If it is a leap year, then RTC time in seconds = RTC time in seconds + 86400. Then increment the year number by 1 and return to step S803; S805. Determine whether the current year is a leap year and whether the month is greater than 2. If the year of the RTC date and time is a leap year and the month of the RTC date and time is greater than 2, then RTC time seconds = RTC time seconds + 86400; Obtain the cumulative number of days corresponding to the month of the current RTC date and time according to the array of cumulative days per month in a non - leap year, and then calculate RTC time seconds: RTC time seconds = RTC time seconds + the cumulative number of days corresponding to the month of the RTC date and time * 86400; Then calculate the time seconds corresponding to the number of days in this month, calculate RTC time seconds: RTC time seconds = RTC time seconds + (the day of the RTC date and time - 1) * 86400; Then calculate the seconds corresponding to hours, minutes, and seconds, calculate RTC time seconds: RTC time seconds = RTC time seconds + the hour of the RTC date and time * 3600 + the minute of the RTC date and time * 60 + the second of the RTC date and time, and set the status of reading the RTC time to successful; Proceed to step S806; S806. Return the status of reading the RTC time and end.

9. A system time timing method based on an in-vehicle charging pile according to claim 8, wherein: In step 9), reset the RTC date and time, convert the system time seconds into the RTC date and time, and then verify the format of the RTC date and time. After passing the verification, directly set the RTC - related registers; S901. It also includes: all seconds = system time seconds - the total historical seconds since 1970; all days = all seconds / 86400, remaining seconds = all seconds % 86400; the hour of the RTC date and time = remaining seconds / 3600, remaining seconds = remaining seconds % 3600; the minute of the RTC date and time = remaining seconds / 60, the second of the RTC date and time = remaining seconds % 60; S903. It also includes: If the year of the RTC date and time is a leap year, then the number of days in a year is equal to 366, otherwise, the number of days in a year is equal to 365.

Citation Information

Patent Citations

  • Time device time calibration method for vehicle device

    CN107957677A

  • Method for obtaining time data in digital processing device

    JP2006172030A