Files
turso/core/io/clock.rs
pedrocarlo 46a7d20c12 clippy
2025-07-17 12:24:43 -03:00

19 lines
419 B
Rust

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Instant {
pub secs: i64,
pub micros: u32,
}
impl<T: chrono::TimeZone> From<chrono::DateTime<T>> for Instant {
fn from(value: chrono::DateTime<T>) -> Self {
Instant {
secs: value.timestamp(),
micros: value.timestamp_subsec_micros(),
}
}
}
pub trait Clock {
fn now(&self) -> Instant;
}