You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: duration.rs
    path of file: ./repos/turbo/crates/turborepo-lib/src/run/summary
    
    the code of the file until where you have to start completion: use std::fmt::{self, Formatter};

use chrono::{DateTime, Duration, Local, SubsecRound};

#[derive(Debug)]
pub struct TurboDuration(Duration);

impl TurboDuration {
    pub fn new(start_time: &DateTime<Local>, end_time: &DateTime<Local>) -> Self {
        TurboDuration(
            end_time
                .trunc_subsecs(3)
                .signed_durati
    
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        let duration = &self.0;

        // If duration is less than a second, we print milliseconds
        if duration.num_seconds() <= 0 {
            let milliseconds = duration.num_milliseconds() - duration.num_seconds() * 1000;
            return write!(f, "{}ms", milliseconds);
        }

        if duration.num_hours() > 0 {
            write!(f, "{}h", duration.num_hours(),)?;
        }

        if duration.num_minutes() > 0 {
            let minutes = duration.num_minutes() - duration.num_hours() * 60;
            write!(f, "{}m", minutes)?;
        }

        if duration.num_seconds() > 0 {
            let seconds_in_ms = duration.num_milliseconds() - duration.num_minutes() * 60 * 1000;
            let seconds = (seconds_in_ms as f64) / 1000.0;
            write!(f, "{}s", seconds)?;
        }

        Ok(())
    }