mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
fix usage of Timespec om the target hermit
This commit is contained in:
parent
50c7344eaf
commit
e1777f9690
@ -40,7 +40,7 @@ impl Timespec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
|
fn checked_add_duration(&self, other: &Duration) -> Option<Timespec> {
|
||||||
let mut secs = self.tv_sec.checked_add_unsigned(other.as_secs())?;
|
let mut secs = self.t.tv_sec.checked_add_unsigned(other.as_secs())?;
|
||||||
|
|
||||||
// Nano calculations can't overflow because nanos are <1B which fit
|
// Nano calculations can't overflow because nanos are <1B which fit
|
||||||
// in a u32.
|
// in a u32.
|
||||||
@ -53,7 +53,7 @@ impl Timespec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> {
|
fn checked_sub_duration(&self, other: &Duration) -> Option<Timespec> {
|
||||||
let mut secs = self.tv_sec.checked_sub_unsigned(other.as_secs())?;
|
let mut secs = self.t.tv_sec.checked_sub_unsigned(other.as_secs())?;
|
||||||
|
|
||||||
// Similar to above, nanos can't overflow.
|
// Similar to above, nanos can't overflow.
|
||||||
let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32;
|
let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32;
|
||||||
|
Loading…
Reference in New Issue
Block a user