mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-20 01:44:19 +01:00
19 lines
419 B
Rust
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;
|
|
}
|