mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
Implement and test time zone name/abbrev setting for Windows.
This commit is contained in:
parent
d12bb7ef72
commit
7d1ae24e19
@ -546,6 +546,8 @@ rule_from_windows_time_zone_info (TimeZoneRule *rule,
|
||||
rule->std_offset = -tzi->Bias * 60;
|
||||
rule->dlt_start.mon = 0;
|
||||
}
|
||||
strncpy (rule->std_name, (gchar*)tzi->StandardName, NAME_SIZE - 1);
|
||||
strncpy (rule->dlt_name, (gchar*)tzi->DaylightName, NAME_SIZE - 1);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
@ -639,6 +641,18 @@ rules_from_windows_time_zone (const gchar *identifier, TimeZoneRule **rules)
|
||||
subkey = g_strconcat (reg_key, key_name, NULL);
|
||||
subkey_dynamic = g_strconcat (subkey, "\\Dynamic DST", NULL);
|
||||
|
||||
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, subkey, 0,
|
||||
KEY_QUERY_VALUE, &key) != ERROR_SUCCESS)
|
||||
return 0;
|
||||
size = sizeof tzi.StandardName;
|
||||
if (RegQueryValueExA (key, "Std", NULL, NULL,
|
||||
(LPBYTE)&(tzi.StandardName), &size) != ERROR_SUCCESS)
|
||||
goto failed;
|
||||
if (RegQueryValueExA (key, "Dlt", NULL, NULL,
|
||||
(LPBYTE)&(tzi.DaylightName), &size) != ERROR_SUCCESS)
|
||||
goto failed;
|
||||
|
||||
RegCloseKey (key);
|
||||
if (RegOpenKeyExA (HKEY_LOCAL_MACHINE, subkey_dynamic, 0,
|
||||
KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -624,7 +624,12 @@ test_GDateTime_new_full (void)
|
||||
g_assert_cmpint (8, ==, g_date_time_get_hour (dt));
|
||||
g_assert_cmpint (4, ==, g_date_time_get_minute (dt));
|
||||
g_assert_cmpint (0, ==, g_date_time_get_second (dt));
|
||||
#ifdef G_OS_UNIX
|
||||
g_assert_cmpstr ("BRT", ==, g_date_time_get_timezone_abbreviation (dt));
|
||||
#elif defined G_OS_WIN32
|
||||
g_assert_cmpstr ("E. South America Standard Time", ==,
|
||||
g_date_time_get_timezone_abbreviation (dt));
|
||||
#endif
|
||||
g_assert (!g_date_time_is_daylight_savings (dt));
|
||||
g_date_time_unref (dt);
|
||||
}
|
||||
@ -879,7 +884,11 @@ GDateTime *__dt = g_date_time_new_local (2009, 10, 24, 0, 0, 0);\
|
||||
TEST_PRINTF ("%%", "%");
|
||||
TEST_PRINTF ("%", "");
|
||||
TEST_PRINTF ("%9", NULL);
|
||||
#ifdef G_OS_UNIX
|
||||
TEST_PRINTF ("%Z", dst);
|
||||
#elsif defined G_OS_WIN32
|
||||
TEST_PRINTF ("%Z", "Pacific Standard Time")
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user