Comment 4 for bug 1001340

Revision history for this message
Jürgen Falch (mail-jfalch) wrote : Re: [Bug 1001340] Re: system_time_zone is set wrong

Hi,

> It does not return 3 letter abbreviation for me, but instead
> W. Europe Standard Time
> W. Europe Daylight Time
the test program returns:
Westeuropäische Normalzeit
Westeuropäische Sommerzeit

> So, I'm basically wondering if localized Windows would return localized> results.
I have googled quite a lot on this, and experimented some. The result appears to be that on a localized windows, the time zone
names returned by GetTimeZoneInformation() are always a) localized, b) "long" names and c) invented by someone at Microsoft,
ie not textually equal to standard Unix/etc timezone names (as found in mysql.time_zone_names).

If such localized Microsoft-specific timezone names are understood inside mysqld, (ie when setting system_time_zone), there is
no bug/problem.

If not, please be so kind as to read my comments to the bug report, especially the second one.
IMHO, a simple way to obtain a valid value for system_time_zone on windows, localized or not, would be:
call GetTimeZoneInformation(&tzi) where tzi is a variable of type TIME_ZONE_INFORMATION:
if the resulting value is 1 (TIME_ZONE_ID_STANDARD), bias= tzi.Bias + tzi.StandardBias;
if the resulting value is 2 (TIME_ZONE_ID_DAYLIGHT), bias= tzi.Bias + tzi.DaylightBias;
(if the resulting value should be other (0), the timezone can not be determined - should not happen.)
Convert the resulting bias (unit: minutes, signed) to +|-hh:mm format, and you should be done.

Best regards,

--
Jürgen Falch
PGP: D4D92BB3