Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Change :func:`datetime.datetime.now` to half-even rounding for
consistency with :func:`datetime.datetime.fromtimestamp`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want you can also add "Patch by (Your name however you want it rendered)." here.

2 changes: 1 addition & 1 deletion Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5539,7 +5539,7 @@ datetime_best_possible(PyObject *cls, TM_FUNC f, PyObject *tzinfo)
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);

Expand Down
Loading