Skip to content

Commit

Permalink
fix: TimeFormatter returning unreadable time
Browse files Browse the repository at this point in the history
  • Loading branch information
Itz-fork committed Dec 26, 2023
1 parent 6d65ad6 commit c6df1fc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions megadl/lib/pyros.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@ def TimeFormatter(milliseconds: int) -> str:
minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)
tmp = f"{days}d, {hours}h, {minutes}m, {seconds}s, {milliseconds}ms,"
return tmp[:-2]

if days > 0:
return f"{days}d"
elif hours > 0:
return f"{hours}h"
elif minutes > 0:
return f"{minutes}m"
elif seconds > 0:
return f"{seconds}s"
else:
return f"{milliseconds}ms"


def humanbytes(size):
Expand Down

0 comments on commit c6df1fc

Please sign in to comment.