MCPcopy Create free account
hub / github.com/FastLED/FastLED / format_elapsed_time

Method format_elapsed_time

ci/util/banner_print.py:175–193  ·  view source on GitHub ↗

Format elapsed time in human-readable form. Args: seconds: Elapsed time in seconds Returns: Formatted string like "2m 30s" or "45s"

(seconds: float)

Source from the content-addressed store, hash-verified

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

Callers 1

format_elapsed_timeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected