Is %z broken for return values of time.gmtime()?

random832 at fastmail.us random832 at fastmail.us
Tue Sep 17 08:48:04 EDT 2013


On Mon, Sep 16, 2013, at 16:55, Michael Schwarz wrote:
> On 2013-W38-1, at 19:56, random832 at fastmail.us wrote:
> 
> > On Mon, Sep 16, 2013, at 9:15, Michael Schwarz wrote:
> >> According to the documentation of time.gmtime(), it returns a struct_time
> >> in UTC, but %z is replaced by +0100, which is the UTC offset of my OS’s
> >> time zone without DST, but DST is currently in effect here (but was not
> >> at the timestamp passed to gmtime()).
> > 
> > The struct_time type does not include information about what timezone it
> > is in.
> 
> Uhm … Python 3.3 introduced the tm_gmtoff member of struct_time, which
> contains the offset to UTC.

I don't see it. Maybe it is not available on platforms that do not
provide it? Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53)
[MSC v.1600 64 bit (AMD64)] on win32)

I would argue that it _should_ be, and that it should populate it with 0
in gmtime or either with timezone/altzone or by some sort of reverse
calculation in localtime, but it is not. Another problem to add to my
list of reasons for my recent python-ideas proposal.



More information about the Python-list mailing list