Format seconds with :02

This commit is contained in:
Midgard 2019-11-18 14:50:11 +01:00
parent 281b7286d6
commit a985c962fe
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -49,9 +49,9 @@ def format_duration(total_seconds):
days, hours = divmod(total_hours, 24)
return (
"{days} days, {hours:02}:{minutes:02}:{seconds}" if days > 0 else
"{hours}:{minutes:02}:{seconds}" if hours > 0 else
"{minutes}:{seconds}"
"{days} days, {hours:02}:{minutes:02}:{seconds:02}" if days > 0 else
"{hours}:{minutes:02}:{seconds:02}" if hours > 0 else
"{minutes}:{seconds:02}"
).format(days=days, hours=hours, minutes=minutes, seconds=seconds)