When using the Development Board, it is found that the RTC time is always set to November 30, 2015, no matter how you set it, use hwclock-W or program to modify the RTC chip, the modified time and RTC time are both correct, but after the power failure is restarted, the time is changed to November 30, 2015.
Through analysis and search, it is found that the timestamp in the/etc/directory is suspicious, and its value is exactly 113011302015. Therefore, there are two files including:/etc/init. bootmisc. SH and save-rtc.sh. Among them, bootmisc. sh contains the following content: # set the system clock from hardware clock # If the timestamp is 1 day or more recent than the current time, # Use the timestamp instead. test-x/etc/init. d/hwclock. sh &/etc/init. d/hwclock. sh startif test-E/etc/timestampthensystemdate = 'date "+ % Y % m % d" 'timestamp = 'cat/etc/timestamp | awk '{print substr ($, 4) substr ($0, 1, 4);} ''needupdate = 'expr \ ($ timestamp \> $ systemdate \) 'If [$ needupdate-EQ 1]; thendate 'cat/etc/timestamp'/etc/init. d/hwclock. the script above sh stopfifi checks whether the file/etc/timestamp exists and compares the timestamp with the current system time, if the timestamp time is one or more days earlier than the system time, the timestamp is used and written to the RTC time. The script save-rtc.sh has the following content :#! /Bin/sh/etc/init. d/hwclock. sh stop # update the timestampdate + % 2 M % 2D % 2 h % 2 M % Y>/etc/timestamp the script above writes the current time to timestamp. At the same time, bootmis. the sh script is linked to the RCS. s55bootmis in D. sh, executed at system startup, and the script save-rtc.sh is linked to the rc0.d and rc6.d folders and executed at system shutdown and restart. To solve the problem above, you only need to: 1. Modify/etc/timestamp to make it less than or equal to the current system time. 2. Shut down or restart the system normally, instead of directly powering off the power. Http://weimenlove.blog.163.com/blog/static/177754732013825111948983/