time: impl From between std / tokio Instants (#1904)

This commit is contained in:
Steven Fackler
2019-12-05 12:03:04 -08:00
committed by Carl Lerche
parent b7ecd35036
commit c3461b3ef3
+12
View File
@@ -126,6 +126,18 @@ impl Instant {
}
}
impl From<std::time::Instant> for Instant {
fn from(time: std::time::Instant) -> Instant {
Instant::from_std(time)
}
}
impl From<Instant> for std::time::Instant {
fn from(time: Instant) -> std::time::Instant {
time.into_std()
}
}
impl ops::Add<Duration> for Instant {
type Output = Instant;