diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:02:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:02:39 (GMT) |
commit | 02937aab13ecfe1f67b8de48c37412b0328217ec (patch) | |
tree | e6ae07581ca459a4b561f479d1610b2c5341fff2 /Modules/timemodule.c | |
parent | b3b454407058cd57d8a401a5aeb018d4ccb87616 (diff) | |
download | cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.zip cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.tar.gz cpython-02937aab13ecfe1f67b8de48c37412b0328217ec.tar.bz2 |
Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 3178fcb..99e83cc 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -173,7 +173,7 @@ time_clock_settime(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "iO:clock_settime", &clk_id, &obj)) return NULL; - if (_PyTime_FromSecondsObject(&t, obj, _PyTime_ROUND_DOWN) < 0) + if (_PyTime_FromSecondsObject(&t, obj, _PyTime_ROUND_FLOOR) < 0) return NULL; if (_PyTime_AsTimespec(t, &tp) == -1) @@ -322,7 +322,7 @@ parse_time_t_args(PyObject *args, char *format, time_t *pwhen) whent = time(NULL); } else { - if (_PyTime_ObjectToTime_t(ot, &whent, _PyTime_ROUND_DOWN) == -1) + if (_PyTime_ObjectToTime_t(ot, &whent, _PyTime_ROUND_FLOOR) == -1) return 0; } *pwhen = whent; |