5 changed files with 71 additions and 43 deletions
@ -1,27 +1,27 @@ |
|||
use std::time::SystemTime; |
|||
use prost_types::Timestamp; |
|||
use std::time::SystemTime; |
|||
|
|||
#[derive(PartialEq)] |
|||
pub struct EpochTime(Timestamp); |
|||
|
|||
impl From<SystemTime> for EpochTime { |
|||
fn from(a: SystemTime) -> Self { |
|||
Self(a.into()) |
|||
} |
|||
fn from(a: SystemTime) -> Self { |
|||
Self(a.into()) |
|||
} |
|||
} |
|||
|
|||
impl From<Timestamp> for EpochTime { |
|||
fn from(a: Timestamp) -> Self { |
|||
Self(a) |
|||
} |
|||
fn from(a: Timestamp) -> Self { |
|||
Self(a) |
|||
} |
|||
} |
|||
|
|||
impl PartialOrd for EpochTime { |
|||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { |
|||
if other.0.seconds == self.0.seconds { |
|||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { |
|||
if other.0.seconds == self.0.seconds { |
|||
self.0.seconds.partial_cmp(&other.0.seconds) |
|||
}else{ |
|||
} else { |
|||
self.0.nanos.partial_cmp(&other.0.nanos) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue