Skip to content

Commit

Permalink
Fix bugs in boot_screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaharia Constantin committed May 19, 2021
1 parent 32fa719 commit fa74b1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def psutil_boot_time(self):
boot_time_delta = datetime.datetime.now() - datetime_boot_time

l1 = "Boot since".format()
l2 = '{}'.format(human_time(second=int(boot_time_delta.seconds)))
l2 = '{}'.format(human_time(seconds=int(boot_time_delta.seconds)))
return (l1, 0), (l2, 1)


Expand Down
4 changes: 2 additions & 2 deletions 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.e", 60), ("sec.", 1)]
units = [("D", 86400), ("H", 3600), ("min", 60), ("", 1)]
parts = []
for unit, mul in units:
if secs / mul >= 1 or mul == 1:
Expand All @@ -137,7 +137,7 @@ def human_time(*args, **kwargs):
secs -= n * mul
else:
n = secs if secs != int(secs) else int(secs)
parts.append("%s %s%s" % (n, unit, "" if n == 1 else "s"))
parts.append("%s%s%s" % (n, unit, "" if n == 1 else "s"))
return ",".join(parts)


Expand Down

0 comments on commit fa74b1f

Please sign in to comment.