Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150922/f0e2334f/attachment.html below:
<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 22, 2015 at 10:55 AM, Alexander Belopolsky <span dir="ltr"><<a href="mailto:alexander.belopolsky@gmail.com" target="_blank">alexander.belopolsky@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"><span class="">On Tue, Sep 22, 2015 at 10:43 AM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</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"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Based on the UTC/local diagram from the "Mind the Gap" section, am I<br>
correct in thinking that the modified invariant that also covers times<br>
in a gap is:<br>
<br>
  dt == datetime.fromtimestamp(dt.astimezone(utc).astimezone(dt.tzinfo).timestamp())<br>
<br>
That is, for local times that exist, the invariant "dt ==<br>
dt.astimezone(utc).astimezone(dt.tzinfo)" holds, but for times that<br>
don't exist, "dt.astimezone(utc).astimezone(dt.tzinfo)" will normalise<br>
them to be a time that actually exists in the original time zone, and<br>
that normalisation also effectively happens when calling<br>
"dt.timestamp()".<br></blockquote><div><br></div></span><div>That can't be right -- There is no way any fromtimestamp() call can return a time in the gap.</div></blockquote><div><br></div></span><div>I don't think Nick said that.</div></blockquote></div><br>On the second reading, it looks like Nick's second sentence contradicts his first. Guido is right. Moreover, there is no way to get a time in the gap as a result of any conversion including astimezone() and fromutc() in addition to fromtimestamp().  Such datetimes may appear if you construct them explicitly, use .replace() to transplant a datetime to another timezone (or modify other components) and in the result of datetime + timedelta operation.</div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4