24
src/util.py
Normal file
24
src/util.py
Normal file
@@ -0,0 +1,24 @@
|
||||
class Util:
|
||||
@staticmethod
|
||||
def format_seconds(seconds):
|
||||
hours = None
|
||||
minutes = seconds / 60
|
||||
if minutes >= 1:
|
||||
if minutes >= 60:
|
||||
hours = int(minutes / 60)
|
||||
minutes = int(minutes % 60)
|
||||
else:
|
||||
minutes = int(minutes)
|
||||
seconds = seconds % 60
|
||||
else:
|
||||
minutes = None
|
||||
|
||||
time = ""
|
||||
if hours is not None and hours != 0:
|
||||
time += str(hours) + "h"
|
||||
if minutes is not None and minutes != 0:
|
||||
time += str(minutes) + "m"
|
||||
if seconds is not None and seconds != 0:
|
||||
time += str(seconds) + "s"
|
||||
|
||||
return time
|
Reference in New Issue
Block a user