]> granicus.if.org Git - python/commit
A quicker astimezone() implementation, rehabilitating an earlier
authorTim Peters <tim.peters@gmail.com>
Wed, 1 Jan 2003 21:51:37 +0000 (21:51 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 1 Jan 2003 21:51:37 +0000 (21:51 +0000)
commitf36151556f834deaa1cb0be3f1d6f3fdf73231eb
tree89a9344a8562550228f505f2f15100802e273c62
parent0233bd9c7d7563392f3fc50d62d7508b52d7de2f
A quicker astimezone() implementation, rehabilitating an earlier
suggestion from Guido, along with a formal correctness proof of the
trickiest bit.  The intricacy of the proof reveals how delicate this
is, but also how robust the conclusion:  correctness doesn't rely on
dst() returning +- one hour (not all real time zones do!), it only
relies on:

1. That dst() returns a (any) non-zero value if and only if daylight
   time is in effect.

and

2. That the tzinfo subclass implements a consistent notion of time zone.

The meaning of "consistent" was a hidden assumption, which is now an
explicit requirement in the docs.  Alas, it's an unverifiable (by the
datetime implementation) requirement, but so it goes.
Doc/lib/libdatetime.tex
Lib/test/test_datetime.py
Modules/datetimemodule.c