[tz] Support for the IANA database in the Python standard library

Paul Eggert eggert at cs.ucla.edu
Wed Feb 26 21:22:58 UTC 2020


On 2/26/20 7:14 AM, Paul Ganssle wrote:
> I have heard a potential proposal for doing things like "find out what 
> ZoneInfo, if any, applies to my current locale and get a time zone 
> object for it", but I consider this mostly out of scope

What may well be in scope, though, is the notion of "wall clock time", 
which is universally supported and which Python applications will almost 
surely want to access.  On GNU/Linux and similar platforms, wall clock 
time is what you get when the TZ environment variable is not set. 
Typically it's determined by /etc/localtime (and defaults to UTC if 
there is no /etc/localtime). In the tzcode reference implementation, you 
can create a wall clock timezone object by calling tzalloc(NULL). Python 
could have ZoneInfo(None) do the same thing.

The reference implementation also supports the notion that TZ='' means 
UTC without leap seconds, though this is less well supported elsewhere 
and since leap seconds are out of scope for you this is not something 
you need to worry about now.


More information about the tz mailing list