tests: skip missing timezones in queries, too

This commit is contained in:
Dirk-Jan C. Binnema
2022-05-18 01:08:40 +03:00
parent 33d30775ee
commit b03590cca8
4 changed files with 54 additions and 18 deletions

View File

@ -625,3 +625,19 @@ Mu::locale_workaround()
return false;
}
bool
Mu::timezone_available(const std::string& tz)
{
const auto old_tz = g_getenv("TZ");
g_setenv("TZ", tz.c_str(), TRUE);
auto tzone = g_time_zone_new_local ();
bool have_tz = g_strcmp0(g_time_zone_get_identifier(tzone), tz.c_str()) == 0;
g_time_zone_unref (tzone);
g_setenv("TZ", old_tz, TRUE);
return have_tz;
}