Cygwin 显示 UTC 时间而不是本地时间
Cygwin shows UTC time instead of local time
今天我注意到我的 cygwin shell 显示了错误的时间。它实际上是 UTC 时间,而它应该是我的本地时间。一旦我取消设置 TZ 变量,它就会显示当地时间。
这里有一些显示情况的命令。
我是 运行 windows 10. 我的 windows 有 UTC-5:00 时区,它的时间是 OK.I 不记得什么时候开始是这样的,但我的同事们电脑很好。有人以前看过这个吗?
$ date
Mon, Oct 31, 2016 9:13:38 PM
$ date --utc
Mon, Oct 31, 2016 9:13:42 PM
$ echo $TZ
America/Toronto
$ unset TZ
$ date
Mon, Oct 31, 2016 5:13:56 PM
$ cygcheck.exe -V
cygcheck (cygwin) 2.6.0
System Checker for Cygwin
Copyright (C) 1998 - 2016 Cygwin Authors
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
您可能已经知道,Cygwin 在此文件中设置时区:
$ tail -1 /etc/profile.d/tzset.sh
test -z "$TZ" && export TZ=$(/usr/bin/tzset)
感谢 matzeri 指出了我的 tzdata,我尝试重新安装 tzdata 并看到有关 cygintl-8.dll 的错误。我在 Cygwin 网站上搜索了那个包,并把它放在那里:
libintl8-0.19.8.1-2 - libintl8:GNU 国际化运行时库(已安装的二进制文件和支持文件)
重新安装软件包,问题已解决。
今天我注意到我的 cygwin shell 显示了错误的时间。它实际上是 UTC 时间,而它应该是我的本地时间。一旦我取消设置 TZ 变量,它就会显示当地时间。
这里有一些显示情况的命令。 我是 运行 windows 10. 我的 windows 有 UTC-5:00 时区,它的时间是 OK.I 不记得什么时候开始是这样的,但我的同事们电脑很好。有人以前看过这个吗?
$ date
Mon, Oct 31, 2016 9:13:38 PM
$ date --utc
Mon, Oct 31, 2016 9:13:42 PM
$ echo $TZ
America/Toronto
$ unset TZ
$ date
Mon, Oct 31, 2016 5:13:56 PM
$ cygcheck.exe -V
cygcheck (cygwin) 2.6.0
System Checker for Cygwin
Copyright (C) 1998 - 2016 Cygwin Authors
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
您可能已经知道,Cygwin 在此文件中设置时区:
$ tail -1 /etc/profile.d/tzset.sh
test -z "$TZ" && export TZ=$(/usr/bin/tzset)
感谢 matzeri 指出了我的 tzdata,我尝试重新安装 tzdata 并看到有关 cygintl-8.dll 的错误。我在 Cygwin 网站上搜索了那个包,并把它放在那里: libintl8-0.19.8.1-2 - libintl8:GNU 国际化运行时库(已安装的二进制文件和支持文件) 重新安装软件包,问题已解决。