[tz] Proper (stable) way to list installed time zones?
eggert at cs.ucla.edu
Fri May 15 19:52:35 UTC 2020
On 5/15/20 7:39 AM, Paul Ganssle wrote:
> I'd say one
> could easily want:
> 1. Every valid value for key that doesn't raise an error when you call
Does ZoneInfo operate by looking for an actual file, or by setting TZ='key' and
seeing whether that works? If the latter, there are many keys that are not
listed anywhere because they're specified by POSIX. A simple example is
TZ='MST7' which is a valid POSIX key and which is commonly used, but for which
there is no file or tzdata.zi entry. I looked at PEP 615 and didn't see any
mention of the issue of POSIX-specified TZ settings.
> I'm still mildly uncertain as to whether it's possible that tzdata.zi
> might have more zones than are actually installed (for example if a
> distro doesn't install anything in backward or antarctica for some reason).
In the reference implementation, the zones are installed from tzdata.zi so the
lists should be identical there.
> Is it always the case that the right/ and posix/ trees are identical to
> the primary tree?
Yes, in the reference implementation.
More information about the tz