DrawingTraining/util.py

25 lines
687 B
Python
Raw Normal View History

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