用ntpdate同步时间

clock -w 硬件同步

如果出错,看一下ntp服务是否启动,可以用service ntpd stop再试

centos设置时钟同步时间_centos 时间同步

如果clock和date时间不同
[xxx@mtg ~]# clock
2016年01月15日 星期五 10时34分39秒  -0.234710 seconds
[xxx@mtg ~]# date
2016年 01月 15日 星期五 10:42:12 CST


硬件时钟和系统时钟同步
[xxx@mtg ~]# hwclock --hctosys
[xxx@mtg ~]# clock
2016年01月15日 星期五 10时37分37秒  -0.859714 seconds
[xxx@mtg ~]# date
2016年 01月 15日 星期五 10:37:41 CST


和时间服务器同步
[xxx@mtg ~]# ntpdate time.windows.com
15 Jan 10:45:45 ntpdate[28529]: step time server time.windows.com offset 449.438743 sec
[xxx@mtg ~]# date
2016年 01月 15日 星期五 10:45:50 CST


系统时钟和硬件时钟同步
[xxx@mtg ~]# hwclock --systohc
[xxx@mtg ~]# date
2016年 01月 15日 星期五 10:46:23 CST
[xxx@mtg ~]# clock
2016年01月15日 星期五 10时46分28秒  -0.640991 seconds