File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -58,4 +58,26 @@ def sleep(self, seconds: int) -> None:
58
58
Args:
59
59
seconds (int): The number of seconds to sleep for.
60
60
"""
61
- time .sleep (seconds )
61
+ time .sleep (seconds )
62
+
63
+ def convert_seconds_to_time (self , rawseconds : int ) -> str :
64
+ """
65
+ Converts seconds to human readable representation.
66
+
67
+ Args:
68
+ rawseconds (int): The number of seconds to convert.
69
+
70
+ Returns:
71
+ str: The human readable representation of the time.
72
+ """
73
+ days = rawseconds // 86400
74
+ hours = (rawseconds - days * 86400 ) // 3600
75
+ minutes = (rawseconds - days * 86400 - hours * 3600 ) // 60
76
+ seconds = rawseconds - days * 86400 - hours * 3600 - minutes * 60
77
+
78
+ time = (("{0} day{1}, " .format (days , "s" if days != 1 else "" ) if days else "" ) + \
79
+ ("{0} hour{1}, " .format (hours , "s" if hours != 1 else "" ) if hours else "" ) + \
80
+ ("{0} minute{1}, " .format (minutes , "s" if minutes != 1 else "" ) if minutes else "" ) + \
81
+ ("{0} second{1}, " .format (seconds , "s" if seconds != 1 else "" ) if seconds else "" ))[0 :- 2 ]
82
+
83
+ return time
You can’t perform that action at this time.
0 commit comments