Linux的時間分爲 System Clock(系統時間)和 Real Time Clock(硬件時間,簡稱RTC)。
1-查看系統時間:
date
2:查看硬件時間:
hwclock
3:刪除本地時間
rm -rf /etc/localtime
4:創建軟連接
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
5:時間同步
ntpdate ntp1.aliyun.com
6. 若提示 command not found,則安裝
yum -y install ntp ntpdate
7:校準硬件時間和軟件時間一致
/sbin/hwclock --systohc
8:查看時間
date
hwclock