relay_common::time

Function duration_to_millis

source
pub fn duration_to_millis(duration: Duration) -> f64
Expand description

Returns the number of milliseconds contained by this Duration as f64.

The returned value does include the fractional (nanosecond) part of the duration.

ยงExample

use std::time::Duration;

let duration = Duration::from_nanos(2_125_000);
let millis = relay_common::time::duration_to_millis(duration);
assert_eq!(millis, 2.125);