From fca096756378b446f5be018668fe9d3da5f4afe1 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Sun, 4 Oct 2026 23:46:00 +0700 Subject: [PATCH] refactor(time): consolidate ClockId usage via the public `time::Clock` trait Remove direct `rustix::time::ClockId` imports by centralizing its dependency within the `time` module. --- src/metrics.rs | 1 - src/pinger_icmp.rs | 1 - src/pinger_icmp_ts.rs | 1 - src/ratecontroller.rs | 1 - src/time.rs | 2 +- 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/metrics.rs b/src/metrics.rs index 0caa6fa..a989161 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -7,7 +7,6 @@ use crate::settings::{MeasurementType, ObservabilityProtocol}; use crate::time::{ClockSample, Realtime}; use flume::{Receiver, RecvTimeoutError, Sender}; use log::{error, info, warn}; -use rustix::time::ClockId; use std::fmt::Write; use std::net::{IpAddr, TcpStream, UdpSocket}; use std::sync::Arc; diff --git a/src/pinger_icmp.rs b/src/pinger_icmp.rs index 8bc5567..7dfceea 100644 --- a/src/pinger_icmp.rs +++ b/src/pinger_icmp.rs @@ -14,7 +14,6 @@ use crate::time::{ClockSample, Monotonic}; use icmp_socket2::Icmpv4Message; use icmp_socket2::Icmpv4Packet; use icmp_socket2::packet::WithEchoRequest; -use rustix::time::ClockId; pub struct PingerICMPEchoListener {} diff --git a/src/pinger_icmp_ts.rs b/src/pinger_icmp_ts.rs index 6aa23be..79246da 100644 --- a/src/pinger_icmp_ts.rs +++ b/src/pinger_icmp_ts.rs @@ -11,7 +11,6 @@ use crate::time::{ClockSample, Realtime}; use icmp_socket2::Icmpv4Message; use icmp_socket2::Icmpv4Packet; use icmp_socket2::packet::WithTimestampRequest; -use rustix::time::ClockId; use std::net::IpAddr; use std::time::Instant; diff --git a/src/ratecontroller.rs b/src/ratecontroller.rs index 33b8bac..230ba81 100644 --- a/src/ratecontroller.rs +++ b/src/ratecontroller.rs @@ -17,7 +17,6 @@ use crate::time::{ClockSample, Realtime}; use crate::util::{ArcRwLock, RwLockExt}; use flume::{Receiver, Sender}; use log::{debug, info, warn}; -use rustix::time::ClockId; use std::fs::File; use std::io::Write; use std::net::IpAddr; diff --git a/src/time.rs b/src/time.rs index 7b6830b..d6da605 100644 --- a/src/time.rs +++ b/src/time.rs @@ -6,7 +6,7 @@ use std::marker::PhantomData; use rustix::time::{ClockId, clock_gettime}; -trait Clock { +pub trait Clock { const ID: ClockId; }