Cygwin shows UTC time instead of local time

我的未来我决定 提交于 2019-12-20 02:33:03

问题


Today I noticed my cygwin shell is showing the wrong time. It is actually UTC time while it is supposed to be my local time. As soon as I unset the TZ variable it shows the local time.

Here are some commands which show the situation. I am running windows 10. My windows has UTC-5:00 timezone and its time is OK.I do not remember when did it start to be like this but my colleagues computers are fine. Has anyone seen this before ?

$ 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.

As you might already know, Cygwin sets the timezone in this file :

$ tail -1 /etc/profile.d/tzset.sh
test -z "$TZ" && export TZ=$(/usr/bin/tzset)

回答1:


Thanks to matzeri that pointed out my tzdata, I tried to reinstall tzdata and saw an error about cygintl-8.dll. I searched for that package in Cygwin web site and fount it there: libintl8-0.19.8.1-2 - libintl8: GNU Internationalization runtime library (installed binaries and support files) reinstalled the package and problem is resolved.



来源:https://stackoverflow.com/questions/40350812/cygwin-shows-utc-time-instead-of-local-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!