Always print minutes if displaying hours.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
This commit is contained in:
Tim 'mithro' Ansell 2019-02-05 21:27:45 -08:00
parent d21433b3de
commit a82882a4c0
1 changed files with 3 additions and 3 deletions

View File

@ -31,11 +31,11 @@ def pretty_timedelta_str(d):
'2m05s'
>>> pretty_timedelta_str(timedelta(seconds=secs_in_hour * 5))
'5h'
'5h00m'
Once we get to displaying hours, we don't bother displaying seconds.
>>> pretty_timedelta_str(timedelta(seconds=secs_in_hour * 5 + 1))
'5h'
'5h00m'
>>> pretty_timedelta_str(timedelta(
... seconds=secs_in_hour * 5 + secs_in_min * 2 + 1))
@ -55,7 +55,7 @@ def pretty_timedelta_str(d):
ts -= hours * secs_in_hour
mins = int(ts / secs_in_min)
if mins > 0:
if mins > 0 or hours > 0:
if hours > 0:
bits.append("{:02d}m".format(mins))
else: