diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/rustix/src/timespec.rs | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/timespec.rs')
-rw-r--r-- | vendor/rustix/src/timespec.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/vendor/rustix/src/timespec.rs b/vendor/rustix/src/timespec.rs index 51c2d2443..a2df0e7b9 100644 --- a/vendor/rustix/src/timespec.rs +++ b/vendor/rustix/src/timespec.rs @@ -1,6 +1,7 @@ //! `Timespec` and related types, which are used by multiple public API //! modules. +#[cfg(not(fix_y2038))] use crate::backend::c; /// `struct timespec` @@ -28,18 +29,22 @@ pub type Secs = c::time_t; #[cfg(fix_y2038)] pub type Secs = i64; -/// A type for the `tv_nsec` field of [`Timespec`]. -#[cfg(all(libc, target_arch = "x86_64", target_pointer_width = "32"))] +/// A type for the `tv_sec` field of [`Timespec`]. +#[cfg(any( + fix_y2038, + linux_raw, + all(libc, target_arch = "x86_64", target_pointer_width = "32") +))] pub type Nsecs = i64; /// A type for the `tv_nsec` field of [`Timespec`]. -#[cfg(all(libc, not(all(target_arch = "x86_64", target_pointer_width = "32"))))] +#[cfg(all( + not(fix_y2038), + libc, + not(all(target_arch = "x86_64", target_pointer_width = "32")) +))] pub type Nsecs = c::c_long; -/// A type for the `tv_nsec` field of [`Timespec`]. -#[cfg(linux_raw)] -pub type Nsecs = i64; - /// On 32-bit glibc platforms, `timespec` has anonymous padding fields, which /// Rust doesn't support yet (see `unnamed_fields`), so we define our own /// struct with explicit padding, with bidirectional `From` impls. @@ -52,7 +57,7 @@ pub(crate) struct LibcTimespec { #[cfg(target_endian = "big")] padding: core::mem::MaybeUninit<u32>, - pub(crate) tv_nsec: Nsecs, + pub(crate) tv_nsec: i32, #[cfg(target_endian = "little")] padding: core::mem::MaybeUninit<u32>, @@ -64,7 +69,7 @@ impl From<LibcTimespec> for Timespec { fn from(t: LibcTimespec) -> Self { Self { tv_sec: t.tv_sec, - tv_nsec: t.tv_nsec, + tv_nsec: t.tv_nsec as _, } } } @@ -75,7 +80,7 @@ impl From<Timespec> for LibcTimespec { fn from(t: Timespec) -> Self { Self { tv_sec: t.tv_sec, - tv_nsec: t.tv_nsec, + tv_nsec: t.tv_nsec as _, padding: core::mem::MaybeUninit::uninit(), } } |