import time

class Timer:
    MILLI_SECONDS = "milliseconds"
    SECONDS = "seconds"
    MINUTES = "minutes"
    HOURS = "hours"
    def __init__(self, name=None):
        self.start_time = None
        self.end_time = None
        self.name = name

    def start(self):
        self.start_time = time.time()

    def stop(self):
        self.end_time = time.time()

    def elapsed_time(self):
        return int(self.end_time - self.start_time)
    
    def get_elasped_time_str(self, format):
        if format == Timer.SECONDS:
            return f"Elapsed time in <{self.name}>: {self.elapsed_time()} seconds"
        elif format == Timer.MINUTES:
            return f"Elapsed time in <{self.name}>: {self.elapsed_time() // 60} minutes, {self.elapsed_time() % 60} seconds"
        elif format == Timer.HOURS:
            return f"Elapsed time in <{self.name}>: {self.elapsed_time() // 3600} hours, {(self.elapsed_time() % 3600)//60} minutes, {self.elapsed_time() % 60} seconds"
        elif format == Timer.MILLI_SECONDS:
            return f"Elapsed time in <{self.name}>: {(self.end_time - self.start_time) * 1000} milliseconds"
        else:
            return f"Invalid format: {format}"