fn format_duration(duration: &chrono::Duration) -> String {
    let seconds = {
        let seconds = duration.num_seconds() % 60;
        if seconds < 10 {
            format!("0{}", seconds)
        } else {
            format!("{}", seconds)
        }
    };

    let minutes = {
        let minutes = duration.num_minutes() % 60;
        if minutes < 10 {
            format!("0{}", minutes)
        } else {
            format!("{}", minutes)
        }
    };

    let hours = {
        let hours = duration.num_hours() % 24;
        if hours < 10 {
            format!("0{}", hours)
        } else {
            format!("{}", hours)
        }
    };

    let days = duration.num_days().to_string();

    format!("{}d {}:{}:{}", days, hours, minutes, seconds)
}
/// Format chrono::Duration to be more human-friendly.
///
/// # Arguments
///
/// * `duration` - A duration of time
Format chrono::Duration to be more human-friendly.
Format chrono :: Duration to be more human - friendly .
fn format_duration(duration: &chrono::Duration) -> String {
    let seconds = {
        let seconds = duration.num_seconds() % 60;
        if seconds < 10 {
            format!("0{}", seconds)
        } else {
            format!("{}", seconds)
        }
    };
    let minutes = {
        let minutes = duration.num_minutes() % 60;
        if minutes < 10 {
            format!("0{}", minutes)
        } else {
            format!("{}", minutes)
        }
    };
    let hours = {
        let hours = duration.num_hours() % 24;
        if hours < 10 {
            format!("0{}", hours)
        } else {
            format!("{}", hours)
        }
    };
    let days = duration.num_days().to_string();
    format!("{}d {}:{}:{}", days, hours, minutes, seconds)
}
fn format_duration ( duration : & chrono :: Duration ) -> String { let seconds = { let seconds = duration . num_seconds ( ) % 60 ; if seconds < 10 { format ! ( " " seconds ) } else { format ! ( " " seconds ) } } ; let minutes = { let minutes = duration . num_minutes ( ) % 60 ; if minutes < 10 { format ! ( " " minutes ) } else { format ! ( " " minutes ) } } ; let hours = { let hours = duration . num_hours ( ) % 24 ; if hours < 10 { format ! ( " " hours ) } else { format ! ( " " hours ) } } ; let days = duration . num_days ( ) . to_string ( ) ; format ! ( " " days hours minutes seconds ) }
Format chrono::Duration to be more human-friendly.
Format chrono :: Duration to be more human - friendly .
duration
&chrono::Duration
duration
&chrono::Duration