2020-06-16 14:56:29 +08:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
2020-04-25 06:18:45 +08:00
|
|
|
pub struct Milliseconds(pub u64);
|
2020-04-25 07:18:49 +08:00
|
|
|
|
|
|
|
impl core::ops::Add for Milliseconds {
|
|
|
|
type Output = Self;
|
|
|
|
|
|
|
|
fn add(self, rhs: Self) -> Self::Output {
|
|
|
|
Milliseconds(self.0 + rhs.0)
|
|
|
|
}
|
|
|
|
}
|
2020-07-23 05:41:15 +08:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
|
|
|
pub struct Microseconds(pub u64);
|
|
|
|
|
|
|
|
impl core::ops::Add for Microseconds {
|
|
|
|
type Output = Self;
|
|
|
|
|
|
|
|
fn add(self, rhs: Self) -> Self::Output {
|
|
|
|
Microseconds(self.0 + rhs.0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait TimeSource<U> {
|
|
|
|
fn now(&self) -> U;
|
|
|
|
}
|