Windows programs get timezone info from the system where you set it via control panel. Time itself can be set manually too, but it is more usual to let Windows synchronize with time servers via Windows Time Service (NTP-based; for usage see WinXP support article). AFAIK Windows Time Service has nothing to do with timezone and is the only network-related thing involved in the problem.
Cygwin programs should in theory behave the same way as on any other *NIX. They get the timezone information from /etc/localtime
file or TZ
environment variable. In my case (Debian), /etc/localtime
is a copy of /usr/share/zoneinfo/Europe/Prague
, but it could be a symlink pointing to that location as well. TZ
can contain path relative to /usr/share/zoneinfo
and takes precedence over /etc/localtime
.
Practice is a different story. According to a thread on Cygwin mailing list, Microsoft C runtime (mscrt*.dll) has extremely outdated timezone handling and it is used for non-Cygwin programs. This is consistent with the results you are getting. Related technical info is in a thread from August 2005 and a related one from May 2010.
There is a work-around for Python already posted on SO and exactly the same for C++, which has a more brief explanation of the MSCRT problem than the previously linked threads.
Maybe Emacs has something special to do with the issue. A February 2009 message on GNU Emacs developers mailing list reports Emacs 22.3 displays correct time while Emacs 23 not. Following advice from a reply, the author posts the report to Cygwin mailing list – but gets no reply. December 2012 the issue is solved by docummenting it and its workaround (see /usr/share/doc/Cygwin/emacs.README
). I don't have Cygwin and cannot find this file in its CVS, so please edit my answer with the info from there.
Personally I think that setting (and exporting) TZ environment variable in your ~/.profile
would be a good idea. Cygwin obviously has broken timezone handling, so overriding everything related should be the safest thing to do as it leaves just a little room for black magic. Maybe tzset
will work, maybe it won't and you'll have to set your timezone to a constant value.
Try googling for „timezone“ at Cygwin.com for more resources.