diff --git a/src/time.rs b/src/time.rs index 13f3b78..4be1607 100644 --- a/src/time.rs +++ b/src/time.rs @@ -14,16 +14,11 @@ pub trait Clock { } pub enum Realtime {} -pub enum Monotonic {} impl Clock for Realtime { const ID: ClockId = ClockId::Realtime; } -impl Clock for Monotonic { - const ID: ClockId = ClockId::Monotonic; -} - pub struct ClockSample { time_s: u64, time_ns: u64, @@ -56,10 +51,6 @@ impl ClockSample { pub fn as_secs_f64(&self) -> f64 { self.time_s as f64 + self.time_ns as f64 / 1_000_000_000.0 } - - pub fn to_milliseconds(&self) -> u64 { - (self.time_s * 1000) + (self.time_ns / 1000000) - } } impl ClockSample { diff --git a/src/util.rs b/src/util.rs index d7d1855..31c988c 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,20 +3,10 @@ // SPDX-License-Identifier: MPL-2.0 use anyhow::anyhow; -use std::sync::{Arc, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}; +use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}; pub type ArcRwLock = Arc>; -pub trait MutexExt { - fn lock_anyhow(&self) -> anyhow::Result>; -} - -impl MutexExt for Mutex { - fn lock_anyhow(&self) -> anyhow::Result> { - self.lock().map_err(|e| anyhow!("mutex poisoned: {e}")) - } -} - pub trait RwLockExt { fn read_anyhow(&self) -> anyhow::Result>; fn write_anyhow(&self) -> anyhow::Result>;