Reprinted from: http://www.linuxidc.com/Linux/2016-07/133755.htm
Linux time is divided into System Clock (system time) and Real Time Clock (hardware time, RTC for short).
System time: refers to the time in the current Linux Kernel.
Hardware time: Time when there is battery power on the motherboard.
Command to view system time: #date
Command to set system time: #date –set (month/day/year hour:minute:second)
例:#date –set “10/11/10 10:15”
Command to view hardware time: # hwclock
Command to set hardware time: # hwclock –set –date = (month/day/year hour:minute:second)
The above mentioned is to manually set the time to a point in time, which may be different from the time of the current network. The following describes the method of synchronizing with the time on the time server
- Install the ntpdate tool
yum -y install ntp ntpdate
- Set the system time to synchronize with the network time
ntpdate cn.pool.ntp.org
- Write system time to hardware time