<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 25, 2015 at 7:19 PM, Akira Li <span dir="ltr"><<a href="mailto:4kir4.1i@gmail.com" target="_blank">4kir4.1i@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1jj" class="" style="overflow:hidden">Here's a distilled example:<br>
<br>
  >>> from datetime import datetime, timezone<br>
  >>> datetime(2013, 10, 28, tzinfo=timezone.utc).astimezone().strftime('%Z%z')<br>
<br>
If you *disable tm_gmtoff attribute* then it produces UTC+04:00+0400.<br>
That differs from the expected output MSK+0400, like the same code<br>
demonstrates if you enable the attribute. Notice (direct quote): "if<br>
tm_gmtoff or tm_zone are not available" above.</div></blockquote></div><br>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</div><div class="gmail_extra"><br></div><div class="gmail_extra">>>> del datetime.timezone</div><div class="gmail_extra"><br></div><div class="gmail_extra">the datetime module does not support even the UTC timezone!</div></div>