gdate.c: Use standard name if no daylight saving exists

We should normally have a standard name for the time zone even if we don't
have daylight saving in the time zone, so use the standard name also when
GetTimeZoneInformation() returns TIME_ZONE_ID_UNKNOWN[1][2].

[1]: https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-gettimezoneinformation
[2]: https://docs.microsoft.com/zh-tw/windows/win32/api/timezoneapi/nf-timezoneapi-settimezoneinformation
This commit is contained in:
Chun-wei Fan 2022-04-11 12:17:25 +08:00
parent fd79c8742b
commit 697d3112b0

View File

@ -2556,9 +2556,7 @@ win32_strftime_helper (const GDate *d,
break;
case 'Z':
n = GetTimeZoneInformation (&tzinfo);
if (n == TIME_ZONE_ID_UNKNOWN)
;
else if (n == TIME_ZONE_ID_STANDARD)
if (n == TIME_ZONE_ID_UNKNOWN || n == TIME_ZONE_ID_STANDARD)
g_array_append_vals (result, tzinfo.StandardName, wcslen (tzinfo.StandardName));
else if (n == TIME_ZONE_ID_DAYLIGHT)
g_array_append_vals (result, tzinfo.DaylightName, wcslen (tzinfo.DaylightName));