[Datetime-SIG] how does PEP-495 help improve dateutil, pytz timezone packages?

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Aug 26 01:45:19 CEST 2015

On Tue, Aug 25, 2015 at 7:19 PM, Akira Li <4kir4.1i at gmail.com> wrote:

> Here's a distilled example:
>   >>> from datetime import datetime, timezone
>   >>> datetime(2013, 10, 28,
> tzinfo=timezone.utc).astimezone().strftime('%Z%z')
> If you *disable tm_gmtoff attribute* then it produces UTC+04:00+0400.
> That differs from the expected output MSK+0400, like the same code
> demonstrates if you enable the attribute. Notice (direct quote): "if
> tm_gmtoff or tm_zone are not available" above.

Of course!  That's why we exposed tm_gmtoff attribute in time.time_struct
on *all platfoms* IIRC.  It's been a long time, by I recall that we went to
some great lengths to emulate tm_gmtoff by comparing the results of
localtime calls to those of gmtime.   Could it be that we missed some
corner cases?  Sure.  But your "if tm_gmtoff or tm_zone are not available"
sounds like complaining that after

>>> del datetime.timezone

the datetime module does not support even the UTC timezone!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150825/7e5545de/attachment.html>

More information about the Datetime-SIG mailing list