(seconds: Union[int, float])
Convert the seconds to human readable string with days, hours, minutes and seconds.
Convert the seconds to human readable string with days, hours, minutes and seconds.
Convert the seconds to human readable string with days hours minutes and seconds .
def format_time(seconds: Union[int, float]) -> str:
    """Convert the seconds to human readable string with days, hours, minutes and seconds."""
    s = int(np.rint(seconds))

    if s < 60:
        return "{0}s".format(s)
    elif s < 60 * 60:
        return "{0}m {1:02}s".format(s // 60, s % 60)
    elif s < 24 * 60 * 60:
        return "{0}h {1:02}m {2:02}s".format(s // (60 * 60), (s // 60) % 60, s % 60)
    else:
        return "{0}d {1:02}h {2:02}m".format(s // (24 * 60 * 60), (s // (60 * 60)) % 24, (s // 60) % 60)
def format_time ( seconds : Union [ int , float ] ) -> str : s = int ( np . rint ( seconds ) ) if s < 60 : return "{0}s" . format ( s ) elif s < 60 * 60 : return "{0}m {1:02}s" . format ( s // 60 , s % 60 ) elif s < 24 * 60 * 60 : return "{0}h {1:02}m {2:02}s" . format ( s // ( 60 * 60 ) , ( s // 60 ) % 60 , s % 60 ) else : return "{0}d {1:02}h {2:02}m" . format ( s // ( 24 * 60 * 60 ) , ( s // ( 60 * 60 ) ) % 24 , ( s // 60 ) % 60 )