Enhanced logic of the formatted_time() method.