devctrl.utility.time.duration_to_string#
- duration_to_string(duration: float, space_between=False) str[source]#
Convert a duration in seconds to a compact time string
Converts duration to a string of the form “<days>d <hours>h <minutes>m <seconds>s” where only the largest non-zero units are included.
- Parameters:
duration – Duration in seconds (can be negative).
space_between – Whether to include a space between value and unit.
- Returns:
Formatted time string with appropriate units