mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-10 02:23:40 +01:00
gtimezone: get 64-bit data from version-3 TZif files
Version 3 was introduced in tzdb 2013e (2013). See Internet RFC 8536 section 3.1 under "ver(sion)".
This commit is contained in:
@@ -534,7 +534,7 @@ init_zone_from_iana_info (GTimeZone *gtz,
|
|||||||
g_return_if_fail (size >= sizeof (struct tzhead) &&
|
g_return_if_fail (size >= sizeof (struct tzhead) &&
|
||||||
memcmp (header, "TZif", 4) == 0);
|
memcmp (header, "TZif", 4) == 0);
|
||||||
|
|
||||||
if (header->tzh_version == '2')
|
if (header->tzh_version >= '2')
|
||||||
{
|
{
|
||||||
/* Skip ahead to the newer 64-bit data if it's available. */
|
/* Skip ahead to the newer 64-bit data if it's available. */
|
||||||
header = (const struct tzhead *)
|
header = (const struct tzhead *)
|
||||||
@@ -574,7 +574,7 @@ init_zone_from_iana_info (GTimeZone *gtz,
|
|||||||
for (index = 0; index < time_count; index++)
|
for (index = 0; index < time_count; index++)
|
||||||
{
|
{
|
||||||
Transition trans;
|
Transition trans;
|
||||||
if (header->tzh_version == '2')
|
if (header->tzh_version >= '2')
|
||||||
trans.time = gint64_from_be (((gint64_be*)tz_transitions)[index]);
|
trans.time = gint64_from_be (((gint64_be*)tz_transitions)[index]);
|
||||||
else
|
else
|
||||||
trans.time = gint32_from_be (((gint32_be*)tz_transitions)[index]);
|
trans.time = gint32_from_be (((gint32_be*)tz_transitions)[index]);
|
||||||
|
|||||||
Reference in New Issue
Block a user