fix usage of Timespec om the target hermit

This commit is contained in:
Stefan Lankes 2023-07-03 07:35:46 +02:00
parent 50c7344eaf
commit e1777f9690

View File

@ -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;