do not fail if None is passed to formatDuration

This commit is contained in:
j 2009-01-11 00:36:30 +05:30
parent 4631911462
commit b70005010d

View file

@ -174,6 +174,8 @@ def formatDuration(ms, verbosity=0, years=True, hours=True, milliseconds=True):
>>> formatDuration(1000 * 30, hours=False, milliseconds=False) >>> formatDuration(1000 * 30, hours=False, milliseconds=False)
'00:30' '00:30'
''' '''
if not ms:
return ''
if years: if years:
y = int(ms / 31536000000) y = int(ms / 31536000000)
d = int(ms % 31536000000 / 86400000) d = int(ms % 31536000000 / 86400000)