首页 > 其他 > 详细

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

时间:2015-09-24 19:42:23      阅读:267      评论:0      收藏:0      [点我收藏+]

错误代码:

       #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

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

原文:http://luochen2015.blog.51cto.com/9772274/1697765

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!