Skip to content

Commit cd5d765

Browse files
committed
cleanup datetime code
remove scories of round half up code and debug code.
1 parent 7667f58 commit cd5d765

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

Lib/datetime.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,6 @@ def _divide_and_round(a, b):
316316

317317
return q
318318

319-
def _round_half_up(x):
320-
"""Round to nearest with ties going away from zero."""
321-
if x >= 0.0:
322-
return _math.floor(x + 0.5)
323-
else:
324-
return _math.ceil(x - 0.5)
325-
326319

327320
class timedelta:
328321
"""Represent the difference between two datetime objects.

Lib/test/datetimetester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def test_microsecond_rounding(self):
679679
us_per_day = us_per_hour * 24
680680
eq(td(days=.4/us_per_day), td(0))
681681
eq(td(hours=.2/us_per_hour), td(0))
682-
eq(td(days=.4/us_per_day, hours=.2/us_per_hour), td(microseconds=1), td)
682+
eq(td(days=.4/us_per_day, hours=.2/us_per_hour), td(microseconds=1))
683683

684684
eq(td(days=-.4/us_per_day), td(0))
685685
eq(td(hours=-.2/us_per_hour), td(0))

0 commit comments

Comments
 (0)