Skip to content

GDate: Fix tests on Windows on certain locales

Chun-wei Fan requested to merge gdate-no-dst into main

Hi,

This attempts to fix GDate and its tests when running on certain locales, specifically locales without daylight saving time and on locales where Windows do not allow "mm/dd/yy" for g_date_set_parse().

So, this updates:

  • win32_strftime_helper() in gdate.c to also return the standard name for the timezone when daylight saving time is not used in the current time zone (GetTimeZoneInformation() returns TIME_ZONE_ID_UNKNOWN1 2), since there should normally be one even for such time zones.

  • Check whether 10/10/76 is accepted by g_date_set_parse() on Windows, since on certain locales this mm/dd/yy format may not be accepted but on others it is accepted. If the system rejects 10/10/76, try again using the "yy/mm/dd" format and continue using that format for the rest of the tests in test_two_digit_years().

This will fix glib/tests/date.c failing when running on Windows in certain locales.

With blessings, thank you!

Edited by Chun-wei Fan

Merge request reports

Loading