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:
Paul Eggert 2020-07-16 12:41:49 -07:00
parent 735c80dc5b
commit 21b000356e

View File

@ -534,7 +534,7 @@ init_zone_from_iana_info (GTimeZone *gtz,
g_return_if_fail (size >= sizeof (struct tzhead) &&
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. */
header = (const struct tzhead *)
@ -574,7 +574,7 @@ init_zone_from_iana_info (GTimeZone *gtz,
for (index = 0; index < time_count; index++)
{
Transition trans;
if (header->tzh_version == '2')
if (header->tzh_version >= '2')
trans.time = gint64_from_be (((gint64_be*)tz_transitions)[index]);
else
trans.time = gint32_from_be (((gint32_be*)tz_transitions)[index]);