Upstream wroberts/pytimeparse state of the touched files before a9e844e72e

This commit is contained in:
upstream committed 2026-09-04 09:31:35 +02:00
1 parent 7b055c8116
commit 9b5ce3ede3
2 files changed
+3 -17

No files matched your search

+3 -7
View File
@@ -172,14 +172,10 @@ def timeparse(sval, granularity='seconds'):
elif ('secs' not in mdict or
mdict['secs'] is None or
mdict['secs'].isdigit()):
# we will return an integer. Round (not truncate) the
# sub-second unit contribution: multiplying a decimal
# quantity such as 2.05 minutes by 60 yields a binary
# float slightly below the exact value (122.999...), and
# int() would truncate it to 122 instead of 123.
# we will return an integer
return (
sign * int(round(sum([MULTIPLIERS[k] * float(v) for (k, v) in
list(mdict.items()) if k != 'secs' and v is not None]))) +
sign * int(sum([MULTIPLIERS[k] * float(v) for (k, v) in
list(mdict.items()) if k != 'secs' and v is not None])) +
(int(mdict['secs'], 10) if mdict['secs'] else 0))
else:
# SECS is a float, we will return a float