summaryrefslogtreecommitdiffstats
path: root/Modules/_datetimemodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-03 07:06:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-03 07:06:44 (GMT)
commit2ec5bd6fb22ff71ffbe5987f55a31bc4177e39a6 (patch)
treebc90e17fecec5aa9476146d19ecc02bb59f5e895 /Modules/_datetimemodule.c
parent0fa5ef72b731c6884f58c0aa38f648b57004c4db (diff)
downloadcpython-2ec5bd6fb22ff71ffbe5987f55a31bc4177e39a6.zip
cpython-2ec5bd6fb22ff71ffbe5987f55a31bc4177e39a6.tar.gz
cpython-2ec5bd6fb22ff71ffbe5987f55a31bc4177e39a6.tar.bz2
Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of rounding towards -Infinity (ROUND_FLOOR).
Diffstat (limited to 'Modules/_datetimemodule.c')
-rw-r--r--Modules/_datetimemodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 6cab1e2..ae459df 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4078,7 +4078,7 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
long us;
if (_PyTime_ObjectToTimeval(timestamp,
- &timet, &us, _PyTime_ROUND_FLOOR) == -1)
+ &timet, &us, _PyTime_ROUND_HALF_UP) == -1)
return NULL;
return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);