您的位置:首页 > 其它

解决系统时间与硬件时钟错误

2015-09-24 11:42 197 查看
错误代码:

#date ###查看系统日期显示日期是前几天
解决方法:
与时间服务器进行时间同步
#ntpdate time.nist.gov
设置时区为东八区
#rm -rf /etc/localtime
#ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
将硬件时间同步为系统时间
#hwclock --systohc
vim /etc/sysconfig/clock 文件里可以看到时区设置和是否启用时区转换的选项
PS:
当Linux启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。
hwclock命令:
-r, --show 读取并打印硬件时钟(read hardware clock and print result )
-s, --hctosys 将硬件时钟同步到系统时钟(set the system time from the hardware clock )
-w, --systohc 将系统时钟同步到硬件时钟(set the hardware clock to the current system time )

本文出自 “珞辰的博客” 博客,请务必保留此出处http://luochen2015.blog.51cto.com/9772274/1697765
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: