[tz] incorrect timezone info from tar files
kre at munnari.OZ.AU
Sat Dec 7 11:39:57 UTC 2019
Date: Fri, 6 Dec 2019 21:23:41 +0000
From: Benjamin Weiser <Benjamin.Weiser at inrix.com>
Message-ID: <BYAPR14MB30633C1E816B79A2B5935F18E85F0 at BYAPR14MB3063.namprd14.prod.outlook.com>
What may be confusing here, is that what this says:
For America/Sao_Paulo it says:
-3:00 Brazil -03/-02
is that for Sao Paulo (for the timezone we call America/Sao_Paulo) the
standard offset from UTC is -3:00 (3 hours west of Greenwich), when
summer time applies is governed by the "Brazil" rules, and the names
of the time (the abbreviations used) are "-03" when it is not summer
time, and "-02" when it is summer time (like EST and EDT in the US).
That's important, the -03/-02 are *not* UTC offsets, they are labels.
A few years ago this might have instead been something like
-3:00 Brazil EBRT/EBRST
using (most probably not those) invented names for the time in winter/summer.
But many of the invented names were removed, and replaced by simple
numeric names that indicate what offset is applying - but they are
just names (labels), they specify nothing else.
That a name exists to label summer time when it applies, does not mean it
ever does, and more likely, does not mean it applies any particular year.
Those names are used for times in the past when summer time was used
(and perhaps again in the future if summer time turns on again.)
This is another important thing to remember - time conversions must
work correctly for times in the past, not just the time today. If I
ask what time it was in Sao Paulo at 11:30 Dec 7 2018 UTC, then I
need to get the conversion done knowing that it was summer time then.
That summer time is not being used this summer does not mean it was
not used last summer, and that the answer to that question would be
different if the year requested was 2019 instead of 2018 simply
reflects how the rules are different this year than they were last year.
The only way to discover if (and if so, when) summer time turns on
and off, in this case is to look at the Brazil rules (elsewhere in the
same source file).
The relevant (recent) rules for Brazil end with (all the comments deleted):
Rule Brazil 2008 2017 - Oct Sun>=15 0:00 1:00 -
Rule Brazil 2008 2011 - Feb Sun>=15 0:00 0 -
Rule Brazil 2012 only - Feb Sun>=22 0:00 0 -
Rule Brazil 2013 2014 - Feb Sun>=15 0:00 0 -
Rule Brazil 2015 only - Feb Sun>=22 0:00 0 -
Rule Brazil 2016 2019 - Feb Sun>=15 0:00 0 -
Rule Brazil 2018 only - Nov Sun>=1 0:00 1:00 -
The first and last of those are the only ones (shown) that enable summer
time (there are of course others for earlier years, but they're not
relevant here, so I didn't include them).
The first (as it indicates) applied from 2008 to 2017. The last applied
in 2018 (only). There is no rule there for turning on summer time in
2019, or any later year.
The intervening rules are all for when summer time turned off in the
various years during this period. The last of those says summer time
(the one that started in early November 2018) ended in mid February, 2019
(as it had in most of the years since 2008, just 2012 and 2015 ended a
week later) All of this is visible in those Rule lines.
After that there is nothing. Summer time turned off in Feb 2019, and
never turns on again (and so never needs to turn off again either).
That is, until the politicians in Brazil decide to change things again,
in which case, after we find out what the new rules will be, we will
need a new release of tzdata to contain that new information.
The Rules are used because there are many different timezones in
Brazil, with different UTC offsets, and different labels to name
what the time is called (for whatever that is worth), but they all
turn summer time on and off (when they use it at all) according to
the same rules - so the rules are specified once, and the zones which
have summer time just reference them. Zones in Brazil which never
use(d) summer time would not reference the Brazil rules, but simply
specify what UTC offset applies, and what to label the time as.
There aren't, but could be, some zones in Brazil which used a
different set of rules, than the others (turned summer time on
and off on different dates). If that were the case, then there
would be another set of rules (perhaps "Brazil2" or "Tropical-Brazil"
or "Northern-Brazil" depending on what seemed appropriate) to
specify those different rules, and the relevant zones would refer
to those - that happens in Australia, where the various states
do whatever they like in this area, and while they seem to all be
in sync right now (for those states which use summer time), they haven't
been in the past. So in AU, each state gets its own set of rules (they
cannot be combined, ever, regardless of the current rules all being
the same, or conversions of times in the past would not be correct).
Other zones (not from Brazil), which have their own unique summer time
rules, not shared with any other zones, might not bother with separate
rules and simply specify the transitions in the zone definition.
Unless you are used to reading the tzdb data source files, it is generally
best not to try - instead run a tzdb compiler (like zic) and then dump
the binary format files, and see when the transitions actually occur.
That's a much much more reliable way of verifying the data then guessing
at how to interpret the tzdata sources.
More information about the tz