On May 9 15:37, Bruno Haible wrote: > Hi, > > Currently, all commands in a Cygwin command window are run with the TZ > environment variable set. > > It is set by /etc/profile.d/tzset.sh (or its csh equivalent, > /etc/profile.d/tzset.csh). > > Setting TZ is harmful in two ways: > > 1) When the user changes the time zone (through the Windows Control Panel) - > for example when traveling - the programs run in the Cygwin command > window will display a stale notion of local time. Only after the user > closes and re-opens a new Cygwin command window, will the programs > display local time according to the new time zone. > > 2) It causes native Windows programs (built through mingw, MSVC) to assume > a time zone that is different from the intended one and different from > the one that the user has set in the Windows Control Panel (see APPENDIX > 1 > below). This is because in most geographies, the values of TZ (produced > by winsup/utils/tzset.c and winsup/utils/tzmap.h) contains a slash, and > the tzset() function in the Microsoft CRT does not understand this syntax > - it understands only a different syntax > https://msdn.microsoft.com/en-us/library/90s5c885.aspx . > > When TZ is not set, both Cygwin and native Windows programs take their time > zone information from the Windows Control Panel settings. See APPENDIX 2 > below and https://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00035.html > . > > What are the benefits of setting the TZ environment variable? I don't > see any!
If we don't do that the tzname variable contains gibberish, because the only information we have is the Windows timezone info, and the content is (who would expect that) non-standard. See also https://cygwin.com/ml/cygwin-developers/2012-01/msg00039.html That's why we opted for always setting TZ. > ===> Please remove /etc/profile.d/tzset.{sh,csh} ! <=== > > Side note: An empty TZ value is equivalent to an unset TZ variable for mingw > and MSVC compiled programs, but not for Cygwin programs (which interpret it as > GMT). See APPENDIX 2 below. We're not striving for Windows compatibility, exactly. What you describe as problem is working the same way in glibc on Linux, see https://linux.die.net/man/3/tzset: "If the TZ variable does appear in the environment, but its value is empty, or its value cannot be interpreted using any of the formats specified below, then Coordinated Universal Time (UTC) is used. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature