devctrl.utility.time.duration_to_string#

duration_to_string(duration: float) 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)

Returns:

Formatted time string with appropriate units