Bug #411 The TZ environment variable is cleared on Windows Servers
Submitted: 9 May 2003 14:29 Modified: 27 Sep 2008 8:00
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:All OS:Any (All Windows)
Assigned to: CPU Architecture:Any

[9 May 2003 14:29] Miguel Solorzano
Description:
Due the code above the TZ variable doesn't works on Windows servers.
/mysys/my_init.c

static void my_win_init(void)
{
.....
 /* Clear the OS system variable TZ and avoid the 100% CPU usage */
 _putenv( "TZ=" ); 
 _tzset()

The introduction of the above code is for a C run-time library bug.

How to repeat:
Set the variable TZ for any value and it won't effect.

Suggested fix:
Open for disccusion.
[3 Jun 2003 7:38] Thomas Studer
More than just that. The --timezone=# variable is not even recognized. Neither in the .ini file nor as a command line variable.
[12 Feb 2004 22:31] Todd Buiten
Any thoughts on when this might get fixed?  We do quite a bit of cross-platform development and we run our production servers in GMT.  Any time we have to try to repro a bug in Windows with data from our Linux machines then our times are all off by eight hours (PST).

Thanks.

- todd
[27 Sep 2008 7:59] Konstantin Osipov
Looking at 5.1 code base, it's been fixed by adding an #ifdef:

#if _MSC_VER < 1300
  /* 
    Clear the OS system variable TZ and avoid the 100% CPU usage
    Only for old versions of Visual C++
  */
  _putenv( "TZ=" ); 
#endif