Skip to content

Commit

Permalink
minimize the length of string from human_time method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaharia Constantin committed May 19, 2021
1 parent 60466c1 commit f5700b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def make_nice(value: float, unit: str = 's'):

def human_time(*args, **kwargs):
secs = float(datetime.timedelta(*args, **kwargs).total_seconds())
units = [("D", 86400), ("H", 3600), ("min", 60), ("s", 1)]
units = [("D", 86400), ("h", 3600), ("m", 60), ("s", 1)]
parts = []
for unit, mul in units:
if secs / mul >= 1 or mul == 1:
Expand Down

0 comments on commit f5700b9

Please sign in to comment.