#!/usr/bin/python3 class Utils: def __init__(self, app): self.app = app def format_time(self, ms): seconds = int(ms / 1000) % 60 minutes = int(ms / (1000 * 60)) % 60 hours = int(ms / (1000 * 60 * 60)) seconds_str, minutes_str, hours_str = ("",) * 3 # create empty strings if hours > 0: hours_str = f"{hours}:" minutes_str = f"{minutes}:".zfill(2) seconds_str = f"{seconds}".zfill(2) output = hours_str + minutes_str + seconds_str return output