summaryrefslogtreecommitdiffstats
path: root/tokio
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2019-12-05 15:03:04 -0500
committerCarl Lerche <me@carllerche.com>2019-12-05 12:03:04 -0800
commitc3461b3ef3866f6335596d1882a52343cef0bcb5 (patch)
tree3fff814c8492227027b85465d0578f5be6d67c2b /tokio
parentb7ecd350365c2695b2cc6f513ef8a5ec7e320916 (diff)
time: impl From between std / tokio Instants (#1904)
Diffstat (limited to 'tokio')
-rw-r--r--tokio/src/time/instant.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tokio/src/time/instant.rs b/tokio/src/time/instant.rs
index faf7b108..ebe991d0 100644
--- a/tokio/src/time/instant.rs
+++ b/tokio/src/time/instant.rs
@@ -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;