summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-01-20 22:54:38 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-01-20 22:54:38 (GMT)
commit327098a613924b4c06e6d79018881aad7939261e (patch)
tree3e6a711d6ab2313bdef80012909de3e3a0769ff1 /Modules/datetimemodule.c
parent4440f22e987f2ccfb798eb8df349884082cccb64 (diff)
downloadcpython-327098a613924b4c06e6d79018881aad7939261e.zip
cpython-327098a613924b4c06e6d79018881aad7939261e.tar.gz
cpython-327098a613924b4c06e6d79018881aad7939261e.tar.bz2
New rule for tzinfo subclasses handling both standard and daylight time:
When daylight time ends, an hour repeats on the local clock (for example, in US Eastern, the clock jumps from 1:59 back to 1:00 again). Times in the repeated hour are ambiguous. A tzinfo subclass that wants to play with astimezone() needs to treat times in the repeated hour as being standard time. astimezone() previously required that such times be treated as daylight time. There seems no killer argument either way, but Guido wants the standard-time version, and it does seem easier the new way to code both American (local-time based) and European (UTC-based) switch rules, and the astimezone() implementation is simpler.
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 0bd49b2..d88fc9e 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -4046,7 +4046,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
PyObject *result;
PyObject *temp;
- int selfoff, resoff, dst1, dst2;
+ int selfoff, resoff, dst1;
int none;
int delta;
@@ -4128,26 +4128,8 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
temp = new_datetime(y, m, d, hh, mm, ss, us, tzinfo);
if (temp == NULL)
goto Fail;
-
- dst2 = call_dst(tzinfo, temp, &none);
- if (dst2 == -1 && PyErr_Occurred()) {
- Py_DECREF(temp);
- goto Fail;
- }
- if (none) {
- Py_DECREF(temp);
- goto Inconsistent;
- }
-
- if (dst1 == dst2) {
- /* The normal case: we want temp, not result. */
- Py_DECREF(result);
- result = temp;
- }
- else {
- /* The "unspellable hour" at the end of DST. */
- Py_DECREF(temp);
- }
+ Py_DECREF(result);
+ result = temp;
return result;
Inconsistent: