1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Description: Use TimeSpec::new( instead of TimeSpec::from(libc::timespec {
The time64 patches to rust-libc add padding to the libc::timespec structure
meaning it can no longer be created by structure instantiation. rust-nix
already contains code that avoids this problem, so lets use it.
Author: Peter Michael Green <plugwash@debian.org>
@@ -149,10 +149,10 @@ pub(crate) fn parse_proc_pid(pid: u32) -
// Use the boottime-based clock to calculate process start
// time, convert to Unix-epoch-based-time.
- let proc_boottime = TimeSpec::from(libc::timespec {
- tv_sec: (starttime / *CLK_TCK) as _,
- tv_nsec: ((starttime % *CLK_TCK) * (1_000_000_000 / *CLK_TCK)) as _,
- });
+ let proc_boottime = TimeSpec::new(
+ (starttime / *CLK_TCK) as _,
+ ((starttime % *CLK_TCK) * (1_000_000_000 / *CLK_TCK)) as _,
+ );
#[cfg(not(target_os = "linux"))]
let proc_age = TimeSpec::from(std::time::Duration::ZERO);
#[cfg(target_os = "linux")]
|