@@ -71,7 +71,7 @@ index bf49ad70590..ff01830e0f6 100644
7171- stx_mtime: libc::statx_timestamp,
7272-
7373 }
74-
74+
7575- // We prefer `statx` on Linux if available, which contains file creation time,
7676- // as well as 64-bit timestamps of all kinds.
7777- // Default `stat64` contains no creation time and may have 32-bit `time_t`.
@@ -92,7 +92,7 @@ index bf49ad70590..ff01830e0f6 100644
9292- #[cfg(target_pointer_width = "32")]
9393- stx_mtime: buf.stx_mtime,
9494 };
95-
95+
9696 Some(Ok(FileAttr { stat, statx_extra_fields: Some(extra) }))
9797@@ -365,36 +349,6 @@ impl FileAttr {
9898 fn from_stat64(stat: stat64) -> Self {
@@ -141,15 +141,15 @@ index bf49ad70590..ff01830e0f6 100644
141141+ tv_nsec: self.stat.st_mtimensec as libc::c_long,
142142+ }))
143143 }
144-
144+
145145 pub fn accessed(&self) -> io::Result<SystemTime> {
146146- Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atimensec as i64))
147147+ Ok(SystemTime::from(libc::timespec {
148148+ tv_sec: self.stat.st_atime as libc::time_t,
149149+ tv_nsec: self.stat.st_atimensec as libc::c_long,
150150+ }))
151151 }
152-
152+
153153 pub fn created(&self) -> io::Result<SystemTime> {
154154- Ok(SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtimensec as i64))
155155+ Ok(SystemTime::from(libc::timespec {
@@ -158,7 +158,7 @@ index bf49ad70590..ff01830e0f6 100644
158158+ }))
159159 }
160160 }
161-
161+
162162@@ -441,19 +404,18 @@ impl FileAttr {
163163 target_os = "vita"
164164 )))]
@@ -176,7 +176,7 @@ index bf49ad70590..ff01830e0f6 100644
176176+ tv_nsec: self.stat.st_mtime_nsec as _,
177177+ }))
178178 }
179-
179+
180180 #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
181181 pub fn modified(&self) -> io::Result<SystemTime> {
182182- Ok(SystemTime::new(self.stat.st_mtime as i64, 0))
@@ -185,7 +185,7 @@ index bf49ad70590..ff01830e0f6 100644
185185+ tv_nsec: 0,
186186+ }))
187187 }
188-
188+
189189 #[cfg(target_os = "horizon")]
190190@@ -468,19 +430,18 @@ pub fn modified(&self) -> io::Result<SystemTime> {
191191 target_os = "vita"
@@ -204,7 +204,7 @@ index bf49ad70590..ff01830e0f6 100644
204204+ tv_nsec: self.stat.st_atime_nsec as _,
205205+ }))
206206 }
207-
207+
208208 #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
209209 pub fn accessed(&self) -> io::Result<SystemTime> {
210210- Ok(SystemTime::new(self.stat.st_atime as i64, 0))
@@ -213,7 +213,7 @@ index bf49ad70590..ff01830e0f6 100644
213213+ tv_nsec: 0,
214214+ }))
215215 }
216-
216+
217217 #[cfg(target_os = "horizon")]
218218@@ -497,7 +458,10 @@ pub fn accessed(&self) -> io::Result<SystemTime> {
219219 target_os = "watchos",
@@ -225,7 +225,7 @@ index bf49ad70590..ff01830e0f6 100644
225225+ tv_nsec: self.stat.st_birthtime_nsec as libc::c_long,
226226+ }))
227227 }
228-
228+
229229 #[cfg(not(any(
230230@@ -513,7 +477,10 @@ pub fn created(&self) -> io::Result<SystemTime> {
231231 cfg_has_statx! {
@@ -244,7 +244,7 @@ index 17b4130c202..4e8dd9a86e7 100644
244244--- a/library/std/src/sys/unix/time.rs
245245+++ b/library/std/src/sys/unix/time.rs
246246@@ -36,6 +36,7 @@ pub(in crate::sys::unix) struct Timespec {
247-
247+
248248 impl SystemTime {
249249 #[cfg_attr(target_os = "horizon", allow(unused))]
250250+ #[cfg_attr(target_env = "gnu", allow(dead_code))]
0 commit comments