Merge pull request #258 from gnustep/NSTimeZone-win32-fix

Windows to IANA time zone conversion: remove unsupported daylight conversion
This commit is contained in:
Hugo Melder 2022-08-11 15:44:33 +02:00 committed by GitHub
commit a79190e6bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2022-08-07 Hugo Melder <contact@hugomelder.com>
* Source/NSTimeZone.m:
Windows to IANA time zone conversion: remove unsupported
TIME_ZONE_ID_DAYLIGHT conversion.
* Tests/base/NSTimeZone/use.m:
Fix test case to check for the correct standard time zone name.
2022-08-05 Hugo Melder <contact@hugomelder.com>
* Tests/base/NSTask/Helpers/GNUmakefile:

View file

@ -1447,15 +1447,23 @@ static NSMapTable *absolutes = 0;
SetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
dst = GetTimeZoneInformation(&tz);
SetThreadUILanguage(origLangID);
// Only tz.StandardName time zone conversions are supported, as
// the Zone-Tzid table lacks all daylight time conversions:
// e.g. 'W. Europe Daylight Time' <-> 'Europe/Berlin' is not listed.
//
// See: https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/zone_tzid.html
tzName = tz.StandardName;
#else
dst = GetTimeZoneInformation(&tz);
#endif
localZoneSource = @"function: 'GetTimeZoneInformation()'";
if (dst == TIME_ZONE_ID_DAYLIGHT)
tzName = tz.DaylightName;
else
tzName = tz.StandardName;
#endif
localZoneSource = @"function: 'GetTimeZoneInformation()'";
#if defined(_MSC_VER) && defined(UCAL_H)
// Convert Windows timezone name to IANA identifier

View file

@ -65,7 +65,7 @@ int main()
testHopeful = YES;
PASS_EQUAL(
[current localizedName: NSTimeZoneNameStyleStandard locale: locale],
@"Brasilia Time",
@"Brasilia Standard Time",
"Correctly localizes standard time zone name")
/* The next few depend on ICU issues