Change `datetime.datetime.now` to half-even rounding
for consistency with `datetime.fromtimestamp`.
Chris Hogan
Tomas Hoger
Jonathan Hogg
+John Keith Hohm
Vladyslav Hoi
Kamilla Holanda
Steve Holden
--- /dev/null
+Change :func:`datetime.datetime.now` to half-even rounding for
+consistency with :func:`datetime.datetime.fromtimestamp`. Patch by
+John Keith Hohm.
time_t secs;
int us;
- if (_PyTime_AsTimevalTime_t(ts, &secs, &us, _PyTime_ROUND_FLOOR) < 0)
+ if (_PyTime_AsTimevalTime_t(ts, &secs, &us, _PyTime_ROUND_HALF_EVEN) < 0) {
return NULL;
+ }
assert(0 <= us && us <= 999999);
return datetime_from_timet_and_us(cls, f, secs, us, tzinfo);