修复 Solaris 10 上的时区
我不知道如何解决这个问题。 在我的 /etc/TIMEZONE 文件中,TZ 变量具有正确的值(加拿大/东部),但仍然显示 -1 小时的滞后。 我还应该去哪里寻找?
I have no ideas how to fix this. In my /etc/TIMEZONE file the TZ variable has the correct value (Canada/Eastern) and still it's showing a -1 hour lag. Where else should I be looking?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该检查您的硬件时钟是什么。
我建议这样做:
$ date -u -s "05:00"
Friday, April 29, 2010 05:00:00 AM UTC
$ rtc -c(“-c”参数正确设置 DST)
$ date
Friday, April 29, 2010 02:00:11 AM ART
问候,
Leandro。
You should check what your hardware clock is.
I would suggest doing this:
$ date -u -s "05:00"
Thursday, April 29, 2010 05:00:00 AM UTC
$ rtc -c (the '-c' argument sets the DST correctly)
$ date
Thursday, April 29, 2010 02:00:11 AM ART
Regards,
Leandro.
您的机器打了最新补丁吗? 2007 年北美的 DST 处理发生了变化。在我的 Solaris 10 上,我有:
-bash-3.00$ ls -l /usr/share/lib/zoneinfo/Canada/Eastern
-rw-r--r-- 2 root bin 1252 2008 年 7 月 14 日 /usr/share/lib/zoneinfo/Canada/Eastern
-bash-3.00$ openssl md5 /usr/share/lib/zoneinfo/加拿大/东部
MD5(/usr/share/lib/zoneinfo/Canada/Eastern)= 82980b1345aab5a97d90307edfefb6da
您使用 NTP 自动设置时间还是手动设置时间?
沃尔克
Is your machine patched up-to-date? There were changes in DST handling for North America in 2007. On my Solaris 10 I have:
-bash-3.00$ ls -l /usr/share/lib/zoneinfo/Canada/Eastern
-rw-r--r-- 2 root bin 1252 Jul 14 2008 /usr/share/lib/zoneinfo/Canada/Eastern
-bash-3.00$ openssl md5 /usr/share/lib/zoneinfo/Canada/Eastern
MD5(/usr/share/lib/zoneinfo/Canada/Eastern)= 82980b1345aab5a97d90307edfefb6da
Do you use NTP to set the time automatically or do you do it manually?
Volker
当您实际登录主机时,您的 shell 会话中设置了什么时区?
如果 shell 会话中的时区与 /etc/TIMEZONE 不匹配,那么您可能需要重新启动才能使时区更改生效。
如果 shell 会话中的时区正确,但实际时间错误,则可能是系统时钟关闭,或者时区定义文件有问题。 您可以运行“date -u”来获取UTC时间,这将帮助您确定实际时钟是否错误。
When you actually log into the host, what timezone is set in your shell session?
If the timezone in your shell session doesn't match /etc/TIMEZONE, then you probably need to reboot for the timezone change to take effect.
If the timezone in your shell session is correct, but the actual time is wrong, then either the system clock is off or the timezone definition file is wrong somehow. You can run "date -u" to get the UTC time, which will help you figure out if the actual clock is wrong.
这是要编辑的正确文件。 唯一需要的其他步骤是重新启动。 需要重新启动的原因是
init
进程在启动时会读取 TZ 的值,并且所有其他进程都会继承该值。 据我所知,如果不完全重新启动,就无法使更改生效。另外,请确保
/etc/TIMEZONE
符号链接到/etc/default/init
。 例如:[root@server:/etc]ls -l /etc/ | grep TIMEZONE
lrwxrwxrwx 1 root root 14 Jul 7 2008 TIMEZONE -> ./默认/init
That is the correct file to edit. The only other step required is a reboot. The reason a reboot is required is that the
init
process reads the value of TZ when it is started, and all other processes inherit this value. As far as I know, there is no way to make the change effective without doing a full reboot.Also, make sure
/etc/TIMEZONE
is symlinked to/etc/default/init
. For example:[root@server:/etc]ls -l /etc/ | grep TIMEZONE
lrwxrwxrwx 1 root root 14 Jul 7 2008 TIMEZONE -> ./default/init