diff --git a/proxmox-time/src/time_span.rs b/proxmox-time/src/time_span.rs index 9eea3f28..6081a534 100644 --- a/proxmox-time/src/time_span.rs +++ b/proxmox-time/src/time_span.rs @@ -128,8 +128,8 @@ pub struct TimeSpan { pub years: u64, } -impl From for f64 { - fn from(ts: TimeSpan) -> Self { +impl From<&TimeSpan> for f64 { + fn from(ts: &TimeSpan) -> Self { (ts.seconds as f64) + ((ts.nsec as f64) / 1_000_000_000.0) + ((ts.usec as f64) / 1_000_000.0) @@ -143,6 +143,12 @@ impl From for f64 { } } +impl From for f64 { + fn from(ts: TimeSpan) -> Self { + Self::from(&ts) + } +} + impl From for TimeSpan { fn from(duration: std::time::Duration) -> Self { let mut duration = duration.as_nanos();