[Python-Dev] Status on PEP-431 Timezones

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Apr 9 01:44:49 CEST 2015


On Wed, Apr 8, 2015 at 7:32 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Thu, Apr 9, 2015 at 8:32 AM, Alexander Belopolsky
> <alexander.belopolsky at gmail.com> wrote:
> > A "named offset" is an abbreviation such as UTC, EST, MSK, MSD which (at
> any
> > given time)
> > corresponds to a fixed offset from UTC.
>
> That assumes the abbreviations are unique. They're not. Just this
> morning I had to explain to a new student of mine that no, my time
> zone is not "EST" = New York time, it's actually "EST" = Melbourne
> time. Granted, most of the time New York and Melbourne are opposite on
> DST, so one will be EST and one EDT, but that trick won't always help
> you.


I should have been more precise in my definitions.  A "named offset" is a
pair
(tm_gmtoff, tm_zone).  Given a location and a UTC time (UNIX timestamp), you
should be able to produce a "named offset".

$ TZ=Australia/Melbourne date -d @1428536256 +"%z %Z"
+1000 EST

The "name" part is usually redundant, but convenient for human readers.

The opposite is not true: you cannot derive location from either or both
parts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150408/4fcfebed/attachment.html>


More information about the Python-Dev mailing list