Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion pytimeparse/tests/testtimeparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def test_fractional_units_exact_integer_results(self):
("0.41w", 247968),
("4.1 minutes", 246),
("4.1h30s", 14790),
("1.33333h", 4799),
("1.33333h", 4800),
("0.33333d", 28800),
("0.3333333333333333d", 28800),
]
for text, expected in cases:
for prefix, sign in [("", 1), ("+", 1), ("-", -1)]:
Expand Down
2 changes: 1 addition & 1 deletion pytimeparse/timeparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def timeparse(sval: str, granularity: str = "seconds") -> Optional[Union[int, fl
return sign * (
# sum exactly so that values such as '4.1m' are
# not truncated one second short by float error
int(
round(
sum(
[
MULTIPLIERS[k] * Decimal(v)
Expand Down