Excerpt from: The relationship between system time and RTC time in Http://www.yunweipai.com/archives/208.html?utm_source=tuicool&utm_medium=referralLinux2012-08-12 09:08 reading 4.4k Comments 0
2017 Gdevops Global Agile Operations Summit-Chengdu Station (limited time offer), Yun Dimensional as the sponsor of this summit, you can click here to learn more
RTC (Real-time clock), translated by real-time clock chip, specifically no longer explained, interested in direct Baidu search under it.
For a server with an operating system installed, the operating system and server hardware itself are recording and updating the current time, which means that the system time and RTC time are two separate sets of timing mechanisms, but they are interdependent:
1) After the initial installation of the operating system, if the installation process does not set the system time, then the default system time is from the server's RTC to obtain the current hardware time;
2) After modifying the system time in the operating system, the OS will usually update the system time to RTC when restarting or shutting down the Linux system;
3) When the operating system is started again, the Linux OS will get the current time from the RTC again.
Simply put,--RTC time is the real continuous update, and the operating system is only after the system startup will continue to update, during the operating system shutdown or restart, even during the server power down, the entire server time depends on the RTC.
The above explanation is a bit around the mouth, then, this phenomenon should pay special attention to:
Server abnormal power down, after the operating system restarts, found that the system time has changed?
The reason is usually: modify the operating system time, after the server abnormal power down, the operating system did not promptly update the modified time to the RTC, resulting in the OS restart, the previous "old" time from the RTC, so at the operating system level is reflected as "time jump".
For this phenomenon, the strategy is: when we modify the system time with the date command on the operating system, it is important to remember to execute the following command to flush the system time to RTC:
# HWCLOCK–SYSTOHC
The relationship between system time and RTC time in Linux