免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: shentutian
打印 上一主题 下一主题

系统时钟比硬件时钟快很多,请各位大侠帮看看 [复制链接]

论坛徽章:
0
31 [报告]
发表于 2008-07-03 16:02 |只看该作者
正好不久前看到《How Linux Works:What Every Super-User Should Know》中的解释:


A well-functioning Unix machine depends on accurate timekeeping. The kernel is responsible for maintaining the system clock, the clock consulted when you run commands such as date. You can also set the system clock with the date command, but this is usually a bad idea, because you'll never get the time exactly right. You want your system clock to be very close to the correct time.

PC hardware has a battery-backed "real-time" clock. It's not the greatest clock in the world, but it's better than nothing. The kernel usually sets its time based on this clock at boot time, and you can reset the system clock to the current hardware time with hwclock. If your hardware clock is in UTC (Universal Coordinated Time, or Greenwich Mean Time), run this command:

hwclock --hctosys --utc


Unfortunately, the kernel isn't terribly good at keeping time, and because Unix machines often stay up for months and years at a time, they tend to develop a drift. In addition, it's fairly rude to make the system clock jump ahead or back by running hwclock on a frequent basis; time-based system events can get lost or munged. If you want to gradually change the system clock based on the hardware clock, run this command:

adjtimex --adjust

However, this is only good for updating the clock manually when it has already drifted. To keep the time up to date, you need to run a network time daemon

[ 本帖最后由 hahasasa 于 2008-7-3 16:29 编辑 ]

论坛徽章:
0
32 [报告]
发表于 2008-07-03 16:18 |只看该作者
为什么不直接把这段话的意思翻译过来呢

论坛徽章:
0
33 [报告]
发表于 2008-07-03 16:32 |只看该作者
应楼上的要求,我把关键字变红了,翻译就没必要了吧。
其实我很早就碰到过此问题,也没彻底解决过。

我维护着的一台Linux上至今仍在crontab中有一句
0 8 * * * /sbin/hwclock --hctosys


因为在我的RHEL4中没有adjtimex
所以书中提到的 adjtimex --adjust 没试过

[ 本帖最后由 hahasasa 于 2008-7-3 16:33 编辑 ]

论坛徽章:
0
34 [报告]
发表于 2008-07-03 17:23 |只看该作者
路过学习了~~~```

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
35 [报告]
发表于 2008-07-03 17:59 |只看该作者
原帖由 hahasasa 于 2008-7-3 16:02 发表
正好不久前看到《How Linux Works:What Every Super-User Should Know》中的解释:


A well-functioning Unix machine depends on accurate timekeeping. The kernel is responsible for maintaining the  ...




tks

论坛徽章:
0
36 [报告]
发表于 2008-07-04 09:00 |只看该作者
timeconfig 把时区好好定一下,

另外timeconfig 的时候,上面有一个 什么选项,选择看看。

论坛徽章:
0
37 [报告]
发表于 2008-07-04 10:18 |只看该作者
学习了。虽然只是很小的一个问题,看回帖学到不少东西

论坛徽章:
0
38 [报告]
发表于 2008-07-04 11:59 |只看该作者
路过学习,没遇到过这情况

论坛徽章:
0
39 [报告]
发表于 2008-07-04 15:11 |只看该作者
我也遇到过这个问题。只要设置时间时把utc功能去掉,Gnome和KDE都可以图形界面设置的。
     快8个小时的原因是你使用了utc时间,utc是指通用协调时间。当你使用utc时间后,计算机关机时写入BIOS的时间是本初子午线时间,比如我在10:00关机,因为我们在东八区,那么关机时写入是BIOS时间是2:00,当11:00时我们打开电脑,此时计算机上BIOS时间是3:00,Linux系统因为启用了UTC时间,它会把3:00加上8小时结果显示11:00,而Windows没有UTC时间功能,当你11:00启动时,它直接读取BIOS为3:00,结果Windows系统显示时间为3:00.

论坛徽章:
0
40 [报告]
发表于 2008-07-04 17:12 |只看该作者
原帖由 shasha528 于 2008-7-4 15:11 发表
我也遇到过这个问题。只要设置时间时把utc功能去掉,Gnome和KDE都可以图形界面设置的。
     快8个小时的原因是你使用了utc时间,utc是指通用协调时间。当你使用utc时间后,计算机关机时写入BIOS的时间是本初子 ...

楼主看看这个吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP