Merge #545
545: time: fix incorrect conversion from std r=Dirbaio a=Dirbaio from #514 cc `@qiujiangkun` Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>master
commit
1ba5283cf7
|
@ -105,7 +105,7 @@ impl Instant {
|
|||
impl From<::std::time::Instant> for Instant {
|
||||
fn from(other: ::std::time::Instant) -> Instant {
|
||||
let elapsed = other.elapsed();
|
||||
Instant::from_millis((elapsed.as_secs() * 1_000000) as i64 + elapsed.subsec_micros() as i64)
|
||||
Instant::from_micros((elapsed.as_secs() * 1_000000) as i64 + elapsed.subsec_micros() as i64)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ impl From<::std::time::SystemTime> for Instant {
|
|||
let n = other
|
||||
.duration_since(::std::time::UNIX_EPOCH)
|
||||
.expect("start time must not be before the unix epoch");
|
||||
Self::from_millis(n.as_secs() as i64 * 1000000 + n.subsec_micros() as i64)
|
||||
Self::from_micros(n.as_secs() as i64 * 1000000 + n.subsec_micros() as i64)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue