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
1 changed files with 2 additions and 0 deletions

View File

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