5 通过网络校时 前面我们说过硬件时钟往往不太准确,系统时钟虽然比较准确,但是仍不能满足高精度的时间要求。最好的方式就是通过NTP协议从专门的时间服务器来读取正确的时间,然后校正系统时间和硬件时钟。
[root@centos192 smstong]# ntpdate -u s1a.time.edu.cn # 通过NTP校时修正系统时间 3 Jun 19:56:42 ntpdate[21550]: adjust time server 202.112.10.60 offset 0.000163 sec [root@centos192 smstong]# hwclock -w # 然后根据矫正过的系统时间设置硬件时钟
如果是长时间运行的服务器,则需要把校时命令写成脚本,通过crond自动定时执行之。










