Format elapsed time in human-readable form. Args: seconds: Elapsed time in seconds Returns: Formatted string like "2m 30s" or "45s"
(seconds: float)
| 173 | |
| 174 | @staticmethod |
| 175 | def format_elapsed_time(seconds: float) -> str: |
| 176 | """Format elapsed time in human-readable form. |
| 177 | |
| 178 | Args: |
| 179 | seconds: Elapsed time in seconds |
| 180 | |
| 181 | Returns: |
| 182 | Formatted string like "2m 30s" or "45s" |
| 183 | """ |
| 184 | if seconds < 60: |
| 185 | return f"{int(seconds)}s" |
| 186 | elif seconds < 3600: |
| 187 | minutes = int(seconds // 60) |
| 188 | secs = int(seconds % 60) |
| 189 | return f"{minutes}m {secs}s" |
| 190 | else: |
| 191 | hours = int(seconds // 3600) |
| 192 | minutes = int((seconds % 3600) // 60) |
| 193 | return f"{hours}h {minutes}m" |
| 194 | |
| 195 | |
| 196 | # Convenience functions for common use cases |
no outgoing calls
no test coverage detected