Cygwin显示UTC时间而不是本地时间 [英] Cygwin shows UTC time instead of local time

查看:483
本文介绍了Cygwin显示UTC时间而不是本地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我注意到我的Cygwin Shell显示了错误的时间。实际上是UTC时间,而应该是我的当地时间。一旦取消设置TZ变量,它就会显示本地时间。

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.

以下是一些显示情况的命令。
我正在运行Windows10。我的Windows具有UTC-5:00时区,并且时间还可以。我不记得它什么时候开始像这样,但是我的同事们的电脑还不错。有人见过吗?

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.

您可能已经知道,Cygwin在此文件中设置时区:

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)


推荐答案

由于matzeri指出了我的tzdata,我试图重新安装tzdata并看到有关cygintl-8.dll的错误。我在Cygwin网站上搜索了该软件包并在其中找到它:
libintl8-0.19.8.1-2-libintl8:GNU国际化运行时库(已安装二进制文件和支持文件)
重新安装了该软件包,问题已解决。

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.

这篇关于Cygwin显示UTC时间而不是本地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆