refactor(time): Introduce typed clock sources for compile-time safety

This change replaces runtime `ClockId` parameters with distinct types to ensure correct clock usage at compile time.
This commit is contained in:
Nils Andreas Svee committed 2026-09-30 12:05:42 +07:00
1 parent e27bab1944
commit 817cc304e6
6 files changed
+46 -26

No files matched your search

+2 -3
View File
@@ -3,9 +3,8 @@
// SPDX-License-Identifier: MPL-2.0
use log::{Level, Metadata, Record, SetLoggerError};
use rustix::time::ClockId;
use crate::time::Time;
use crate::time::{ClockSample, Realtime};
#[derive(Clone, Copy)]
pub struct SimpleLogger {
@@ -19,7 +18,7 @@ impl log::Log for SimpleLogger {
fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
let now = Time::new(ClockId::Realtime);
let now = ClockSample::<Realtime>::now();
println!(
"{} {:5} {}:{}: {}",
now.as_secs_f64(),