LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1827|回复: 17

请教下clock时间问题,困了我很多天了,找过很多地方都解决不了

[复制链接]
发表于 2007-6-26 09:46:28 | 显示全部楼层 |阅读模式
系统是SUSE 10.2
linux:~ # date
Tue Jun 26 09:46:05 UTC 2007
我要把UTC改成CST
clock配置文件:
## Path:                System/Environment/Clock
## Description:         Information about your timezone and time
## Type:                string
## ServiceRestart:      boot.clock
#
# Set to "-u" if your system clock is set to UTC, and to "--localtime"
# if your clock runs that way.
#
HWCLOCK="--localtime"

## Type:                yesno
## Default:             yes
## Description: Write back system time to the hardware clock
#
# Is set to "yes" write back the system time to the hardware
# clock at reboot or shutdown. Usefull if hardware clock is
# much more inaccurate than system clock.  Set to "no" if
# system time does it wrong due e.g. missed timer interrupts.
# If set to "no" the hardware clock adjust feature is also
# skipped because it is rather useless without writing back
# the system time to the hardware clock.
#
SYSTOHC="yes"

## Type:                string(Europe/Berlin,Europe/London,Europe/Paris)
## ServiceRestart:      boot.clock
#
# Timezone (e.g. CET)
# (this will set /usr/lib/zoneinfo/localtime)
#
TIMEZONE="Asia/Shanghai"
DEFAULT_TIMEZONE="US/Eastern"

试过命令date --set="Fri Jun 22 17:40:00 CST 2007"无效
tzselect这个命令也没有。。。

有哪位兄弟帮下忙吗?
谢谢!
发表于 2007-6-26 11:25:11 | 显示全部楼层
cp -av /etc/sysconfig/clock  /etc/sysconfig/clock_old_bak

yast --> 系统 --> 日期和时间
修改之后,系统时间可能会经常的变慢十几分钟或更多。如果出现这种情况,检查 /etc/sysconfig/clock 文件中有没有 HWCLOCK="--localtime"  。其它原因不详。


----------------------------------------------------------------
以下备用:
----------------------------------------------------------------
  1. # tzselect  # 非必须

  2. md5sum /etc/localtime
  3. date
复制代码


拷贝正确时区到 localtime
  1. cp -v --remove-destination /usr/share/zoneinfo/Asia/Shanghai \
  2.     /etc/localtime
  3. date
复制代码


检查与先前是否相同?
  1. md5sum /etc/localtime
复制代码


修改系统时间
  1. sudo date MMDDhhmm[CC]YY[.ss]
复制代码

写入hardware clock
  1. sudo hwclock -w
复制代码



参考:
http://www.in-life.idv.tw/index.php?/archives/362-eecaeaae.html
-----------------------------------------------------------
man timezone
hwclock --help
man ntpdate
------------------------------------------------------------
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-26 14:12:54 | 显示全部楼层
huohuliaisili 谢谢!
很少有你这么详细的
这一步时时间是正确的
md5sum /etc/localtime
date
我发现我机器里没有 /usr/share/zoneinfo/Asia/Shanghai这个目录,不知道为什么
回复 支持 反对

使用道具 举报

发表于 2007-6-26 16:15:15 | 显示全部楼层
Post by bleai
huohuliaisili 谢谢!
很少有你这么详细的
这一步时时间是正确的
md5sum /etc/localtime
date
我发现我机器里没有 /usr/share/zoneinfo/Asia/Shanghai这个目录,不知道为什么


问题是否解决了呢?
是怎样解决的?

在 这个目录下找时区 /usr/share/zoneinfo/
/usr/share/zoneinfo/Asia/Shanghai 这是一个文件。

ls -l  /usr/share/zoneinfo/Asia/Shanghai  
会没有吗?

在这里搜索了一下关键字 "ASia/Shanghai"
http://benjiweber.co.uk:8080

发现这条信息
timezone (2.5)
Timezone descriptions
contains /usr/share/zoneinfo/Asia/Shanghai

在此处有 timezone 的rpm包。当然,你可以用 Yast 搜索一下这个包。
http://anorien.warwick.ac.uk/mirrors/suse/update/10.2/rpm/i586/
http://anorien.warwick.ac.uk/mirrors/suse/update/10.2/rpm/x86_64/
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-26 17:30:27 | 显示全部楼层

现在好像可以了
不知为啥就运行
md5sum /etc/localtime
这个命令好像没这种功能呀?
之前我把系统时间调节器前了八个小时-_-

俺才发现你是那天在群里帮我解决过此问题,原来你一直没忘记,帮我去找答案
谢谢!
在yast里找到了timezone
回复 支持 反对

使用道具 举报

发表于 2007-6-26 21:40:38 | 显示全部楼层
Post by bleai

现在好像可以了
不知为啥就运行
md5sum /etc/localtime
这个命令好像没这种功能呀?
之前我把系统时间调节器前了八个小时-_-

俺才发现你是那天在群里帮我解决过此问题,原来你一直没忘记,帮我去找答案
谢谢!
在yast里找到了timezone

md5sum 我是想验证 /etc/localtime 和 /usr/share/zoneinfo/Asia/Shanghai 是不是同样的。如果MD5值是相同的,证明 /etc/localtime 是使用的 Asin/Shanghai 时间 。
  1. clfs:/ # md5sum /etc/localtime
  2. 7f6b70f5f9d91b58b5d56c6a35faefb2  /etc/localtime
  3. clfs:/ # md5sum /usr/share/zoneinfo/Asia/Shanghai
  4. 7f6b70f5f9d91b58b5d56c6a35faefb2  /usr/share/zoneinfo/Asia/Shanghai
复制代码
回复 支持 反对

使用道具 举报

发表于 2007-6-27 00:13:20 | 显示全部楼层
ntp ntp
回复 支持 反对

使用道具 举报

发表于 2007-6-27 21:34:40 | 显示全部楼层
哈哈,用root用户登录终端运行以下命令:
ntpdate 210.72.145.44
回复 支持 反对

使用道具 举报

发表于 2007-6-28 11:24:25 | 显示全部楼层
Post by opentiss
哈哈,用root用户登录终端运行以下命令:
ntpdate 210.72.145.44

这个命令就是传说中的时间同步?
回复 支持 反对

使用道具 举报

发表于 2007-6-28 11:47:54 | 显示全部楼层
huohuliaisili 你讲的真细.牛人
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表