Add the 's' modifier (allow a string to be "50s1d1d4m1s")
This commit is contained in:
parent
403406b60a
commit
9a32229d0b
1 changed files with 1 additions and 2 deletions
|
@ -194,7 +194,7 @@ def replace_key_with_bound(key):
|
||||||
return key
|
return key
|
||||||
|
|
||||||
def parse_str_to_secs(duration=''):
|
def parse_str_to_secs(duration=''):
|
||||||
values = {'m': 60, 'h': 3600, 'd': 86400}
|
values = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}
|
||||||
result = 0
|
result = 0
|
||||||
tmp = '0'
|
tmp = '0'
|
||||||
for char in duration:
|
for char in duration:
|
||||||
|
@ -211,7 +211,6 @@ def parse_str_to_secs(duration=''):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def parse_secs_to_str(duration=0):
|
def parse_secs_to_str(duration=0):
|
||||||
values = {60: 'm', 3600:'h', 86400:'d'}
|
|
||||||
secs, mins, hours, days = 0, 0, 0, 0
|
secs, mins, hours, days = 0, 0, 0, 0
|
||||||
result = ''
|
result = ''
|
||||||
secs = duration % 60
|
secs = duration % 60
|
||||||
|
|
Loading…
Reference in a new issue