cnhnln 发表于 2006-10-20 22:57:07

etch如何修改硬件时钟?

etch如何修改硬件时钟?
BIOS里的时间已经设置为北京时间
date显示的时间也正确。而且通过“ntpdate 210.72.145.44”校准的误差也可忽略不计。证明系统时钟没问题
可是每次启动后,hwclock显示的时间总是要快8个小时,而且/etc/adjtime的内容含有UTC字样。应该是系统把BIOS里的时间当成是UTC了,通过时区的设置,每次启动后都调整成BIOS时间+8
“hwclock --systohc”后。每次启动后hwclock的显示结果正确了。但是BIOS里的时间就慢了8个小时

简言之就是,系统时钟没问题。怎么修改硬件时钟为本地时间,而且确保每次启动都还是使用本地时间?

linky_fan 发表于 2006-10-22 18:15:12

http://www.debian.org/doc/manuals/system-administrator/ch-sysadmin-time.html

先看看先 :mrgreen:

linky_fan 发表于 2006-10-22 18:16:39

The hwclock command provides the interface to the hardware clock. If you are wanting to ensure the correct time then with a default Debian set up it is recommended that you use ntp instead if you can. When you reboot the system will save the current correct time to the hardware clock.

Anyhow, the --adjust option of the hwclock command checks information stored in the configuration file /etc/adjtime and makes an actual correction to the time stored in the hardware clock to account for the drift that it (the hwclock utility) has been monitoring. (Each time you set the hardware clock with the hwclock command the current time is compared to the previous time it was corrected to determine the amount of drift.) Thus, when setting the system clock from the hardware clock it is advisable to do the following:



# hwclock --adjust
# hwclock --hctosys






When updating the hardware clock from an accurate system clock do:



# hwclock --systohc





补充一下

cnhnln 发表于 2006-10-23 13:54:06

试过了,就是不行才会来问的
hwclock --systohc --localtime后,时间对了。/etc/adjtime的矫正时间也是LOCAL了。但是只要一重起,硬件时间就又出现8小时的偏差了,/etc/adjtime的矫正时间又变成UTC了
应该是debian的某个启动脚本包含了同步硬件时间的命令。但是同步到的是UTC
好像是安装之前没有校对BIOS时间,BIOS里用的是UTC时间,但是安装系统的时候用的是CST。所以才导致此问题
考虑是否要重装系统

linky_fan 发表于 2006-10-24 15:23:07

不会吧, 写一条到rc里去算了 :mrgreen:

cnhnln 发表于 2006-10-26 23:20:01

系统安装版一哥们给了答案

你要改 /etc/default/rcS 这个文件里边的 `UTC=no‘ 应该就行了

http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=169065&highlight=

种草得草 发表于 2006-10-27 08:30:01

系统安装版一哥们给了答案

你要改 /etc/default/rcS 这个文件里边的 `UTC=no‘ 应该就行了

http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=169065&highlight=

正解.

cnhnln 发表于 2006-10-27 13:14:23

不知为何,我的另一台sid的机器没有此问题

me09 发表于 2007-9-27 14:52:29

debian 下一般的默认时间格式是CST
如果不幸是UTC
可执行这个命令 轻松搞定
apt-get install tzdata
页: [1]
查看完整版本: etch如何修改硬件时钟?