Skip to content

Commit

Permalink
better human times fixes #420
Browse files Browse the repository at this point in the history
  • Loading branch information
MattReimer committed Sep 8, 2021
1 parent f97b50b commit 9bfe728
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/commons/rscommons/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def pretty_duration(time_s=False):
"""
if not time_s >= 0:
return '???'
seconds = time_s % 60
seconds = floor(time_s % 60)
minutes = floor(time_s / 60) % 60
hours = floor(time_s / 3600) % 24
if time_s < 60:
Expand Down
3 changes: 3 additions & 0 deletions lib/commons/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def test_pretty_duration(self):
test1 = util.pretty_duration(100)
self.assertEqual(test1, '1:40 minutes')

test1 = util.pretty_duration(103.234234)
self.assertEqual(test1, '1:43 minutes')

test1 = util.pretty_duration(1000)
self.assertEqual(test1, '16:40 minutes')

Expand Down

0 comments on commit 9bfe728

Please sign in to comment.