This is the mail archive of the cygwin-patches mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mar 4 19:42, Christian Franke wrote:Corinna Vinschen wrote:On Mar 2 22:35, Christian Franke wrote:Let another variable change the value passed to Windows environment:Corinna Vinschen wrote:But, as usual, PTC.OK, ...
Simple: Unset TZ for Win32 programs run from Cygwin.would a patch for any of the above have a chance to get accepted?
More flexible: Set (unset) TZ=CYGWIN_WINENV_TZ if this variable is set (to empty). Otherwise keep TZ as is.
If it's not getting too complicated, yes. However, the second idea I don't understand. Can you explain this differently?
$ printenv TZ Europe/Berlin
$ cmd /c echo %TZ% Europe/Berlin
$ export CYGWIN_WINENV_TZ=CET-1CEST
$ printenv TZ Europe/Berlin
$ cmd /c echo %TZ% CET-1CEST
$ export CYGWIN_WINENV_TZ=
$ cmd /c echo %TZ% %TZ% (which means TZ is not set)Hmm. I think just unsetting TZ should be sufficient. MSVCRT uses the current timezone as default anyway, doesn't it?
2012-04-11 Christian Franke <franke@computer.org> * environ.cc (build_env): Don't pass POSIX TZ variable to Win32. TZ may result in incorrect time zone conversions from MSVCRT time functions. diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 33289d2..01ef234 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -1074,6 +1074,11 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc, if (len == 1 || !*rest) continue; + /* Don't pass POSIX TZ variable to Win32. TZ may result in + incorrect time zone conversions from MSVCRT time functions. */ + if (len == 3 && (*srcp)[0] == 'T' && (*srcp)[1] == 'Z') + continue; + /* See if this entry requires posix->win32 conversion. */ conv = getwinenv (*srcp, rest, &temp); if (conv)
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |