fn write_interval(writer: &mut dyn Write, quote: &str, mut interval: i64) -> Result<(), Error> {
    writer.write_all(quote.as_bytes())?;
    if interval == i64::min_value() {
        return write!(writer, "-106751991 04:00:54.775808{}", quote);
    } else if interval < 0 {
        interval = -interval;
        writer.write_all(b"-")?;
    }

    let seconds = interval / 1_000_000;
    let microseconds = interval % 1_000_000;

    let minutes = seconds / 60;
    let seconds = seconds % 60;

    let hours = minutes / 60;
    let minutes = minutes % 60;

    let days = hours / 24;
    let hours = hours % 24;

    if days > 0 {
        write!(writer, "{} ", days)?;
    }
    write!(writer, "{:02}:{:02}:{:02}", hours, minutes, seconds)?;
    if microseconds > 0 {
        write!(writer, ".{:06}", microseconds)?;
    }

    writer.write_all(quote.as_bytes())
}
/// Writes a time interval in the standard SQL format.
Writes a time interval in the standard SQL format.
Writes a time interval in the standard SQL format .
fn write_interval(writer: &mut dyn Write, quote: &str, mut interval: i64) -> Result<(), Error> {
    writer.write_all(quote.as_bytes())?;
    if interval == i64::min_value() {
        return write!(writer, "-106751991 04:00:54.775808{}", quote);
    } else if interval < 0 {
        interval = -interval;
        writer.write_all(b"-")?;
    }
    let seconds = interval / 1_000_000;
    let microseconds = interval % 1_000_000;
    let minutes = seconds / 60;
    let seconds = seconds % 60;
    let hours = minutes / 60;
    let minutes = minutes % 60;
    let days = hours / 24;
    let hours = hours % 24;
    if days > 0 {
        write!(writer, "{} ", days)?;
    }
    write!(writer, "{:02}:{:02}:{:02}", hours, minutes, seconds)?;
    if microseconds > 0 {
        write!(writer, ".{:06}", microseconds)?;
    }
    writer.write_all(quote.as_bytes())
}
fn write_interval ( writer : & mut dyn Write , quote : & str , mut interval : i64 ) -> Result < ( ) , Error > { writer . write_all ( quote . as_bytes ( ) ) ? ; if interval == i64 :: min_value ( ) { return write ! ( writer " " quote ) ; } else if interval < 0 { interval = - interval ; writer . write_all ( b" " ) ? ; } let seconds = interval / 1_000_000 ; let microseconds = interval % 1_000_000 ; let minutes = seconds / 60 ; let seconds = seconds % 60 ; let hours = minutes / 60 ; let minutes = minutes % 60 ; let days = hours / 24 ; let hours = hours % 24 ; if days > 0 { write ! ( writer " " days ) ? ; } write ! ( writer " " hours minutes seconds ) ? ; if microseconds > 0 { write ! ( writer " " microseconds ) ? ; } writer . write_all ( quote . as_bytes ( ) ) }
Writes a time interval in the standard SQL format.
Writes a time interval in the standard SQL format .
writer
&mut dyn Write
quote
&str
interval
i64
writer
&mut dyn Write
quote
&str
interval
i64