+tests
This commit is contained in:
parent
eaa1e15d0b
commit
a0e11de0df
1 changed files with 21 additions and 13 deletions
|
@ -154,6 +154,14 @@ def formatDuration(ms, verbosity=0, years=True, hours=True, milliseconds=True):
|
||||||
milliseconds
|
milliseconds
|
||||||
True: always display milliseconds
|
True: always display milliseconds
|
||||||
False: never display milliseconds
|
False: never display milliseconds
|
||||||
|
>>> formatDuration(1000 * 60 * 60 * 24 * 366)
|
||||||
|
'1:001:00:00:00.000'
|
||||||
|
>>> formatDuration(1000 * 60 * 60 * 24 * 366, year=False)
|
||||||
|
'366:00:00:00.000'
|
||||||
|
>>> formatDuration(1000 * 60 * 60 * 24 * 365 + 2003, verbosity=2)
|
||||||
|
'1 year 2 seconds 3 milliseconds'
|
||||||
|
>>> formatDuration(1000 * 30, hours=False, milliseconds=False)
|
||||||
|
'00:30'
|
||||||
'''
|
'''
|
||||||
if years:
|
if years:
|
||||||
y = int(ms / 31536000000)
|
y = int(ms / 31536000000)
|
||||||
|
|
Loading…
Reference in a new issue