ntpdate 是一个linux时间同步服务软件。
查看本机是否安装ntpdate服务,如果没有安装,请 yum install -y ntpdate
同步时间, 输入ntpdate time.nist.gov同步网络时间
如果上面time.nist.gov服务器同步不了,可以换下面几个时间服务器试试:
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
如果 上面域名都不可以,使用阿里云的IP同步:
ntpdate -d 182.92.12.11
----------------------------
hwclock命令 (即hardwareclock系统硬件时间)
将系统时间写入到系统硬件当中:
#hwclock -w
执行成功后, 查看系统硬件时间(不出意外的话,现在date和hwclock现实的时间均为internet时间)。
#date
#hwclock (显示硬件时间)
执行上述命令,显示的时间应该一样的。