The real-time clock of this single chip microcomputer is just a simple 32-bit counter, counting in seconds. To convert into adult months, days, minutes and seconds, it is completely calculated according to the leap year law of the solar calendar. First, find a reference date, which is called a timestamp.
Then calculate the current year, month, day, minute and second according to the difference between the current time and the timestamp (in seconds), and then find out how many months there are in the lunar calendar every year, when is the Spring Festival, and whether the current date is before or after the Spring Festival, and then calculate the 24 solar terms. Because 24 festivals are divided according to the solar year, the solar year has only 365 days and 366 days. So the date of the 24-day solar calendar is basically fixed. Find a standard, then write down the positive and negative errors of each solar term and the standard date to determine the solar calendar date of the current solar term. As for heavenly stems and earthly branches, as long as there is a benchmark, the remainder of 12 and 10 can be easily calculated.