Create timeformat.py
This commit is contained in:
parent
9356e4e9ca
commit
15b2b259df
1 changed files with 16 additions and 0 deletions
16
plugins/util/timeformat.py
Normal file
16
plugins/util/timeformat.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
def timeformat(seconds):
|
||||||
|
if seconds < 60:
|
||||||
|
timestamp = str(seconds) + "s"
|
||||||
|
elif seconds >= 60 and seconds < 3600:
|
||||||
|
timestamp = "%s:%s" % (seconds/60, seconds%60)
|
||||||
|
elif seconds >= 3600 and seconds < 86400:
|
||||||
|
hours = seconds / 3600
|
||||||
|
seconds = 3600*hours
|
||||||
|
timestamp = "%s:%s:%s" % (hours, seconds/60, seconds%60)
|
||||||
|
elif seconds >= 86400:
|
||||||
|
days = seconds / 86400
|
||||||
|
seconds = 86400*days
|
||||||
|
hours = seconds / 3600
|
||||||
|
seconds = 3600*hours
|
||||||
|
timestamp = "%s days, %s:%s:%s" % (days, hours, seconds/60, seconds%60)
|
||||||
|
return timestamp
|
Reference in a new issue