@@ -71,7 +71,7 @@ index bf49ad70590..ff01830e0f6 100644
71
71
- stx_mtime: libc::statx_timestamp,
72
72
-
73
73
}
74
-
74
+
75
75
- // We prefer `statx` on Linux if available, which contains file creation time,
76
76
- // as well as 64-bit timestamps of all kinds.
77
77
- // Default `stat64` contains no creation time and may have 32-bit `time_t`.
@@ -92,7 +92,7 @@ index bf49ad70590..ff01830e0f6 100644
92
92
- #[cfg(target_pointer_width = "32")]
93
93
- stx_mtime: buf.stx_mtime,
94
94
};
95
-
95
+
96
96
Some(Ok(FileAttr { stat, statx_extra_fields: Some(extra) }))
97
97
@@ -365,36 +349,6 @@ impl FileAttr {
98
98
fn from_stat64(stat: stat64) -> Self {
@@ -141,15 +141,15 @@ index bf49ad70590..ff01830e0f6 100644
141
141
+ tv_nsec: self.stat.st_mtimensec as libc::c_long,
142
142
+ }))
143
143
}
144
-
144
+
145
145
pub fn accessed(&self) -> io::Result<SystemTime> {
146
146
- Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atimensec as i64))
147
147
+ Ok(SystemTime::from(libc::timespec {
148
148
+ tv_sec: self.stat.st_atime as libc::time_t,
149
149
+ tv_nsec: self.stat.st_atimensec as libc::c_long,
150
150
+ }))
151
151
}
152
-
152
+
153
153
pub fn created(&self) -> io::Result<SystemTime> {
154
154
- Ok(SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtimensec as i64))
155
155
+ Ok(SystemTime::from(libc::timespec {
@@ -158,7 +158,7 @@ index bf49ad70590..ff01830e0f6 100644
158
158
+ }))
159
159
}
160
160
}
161
-
161
+
162
162
@@ -441,19 +404,18 @@ impl FileAttr {
163
163
target_os = "vita"
164
164
)))]
@@ -176,7 +176,7 @@ index bf49ad70590..ff01830e0f6 100644
176
176
+ tv_nsec: self.stat.st_mtime_nsec as _,
177
177
+ }))
178
178
}
179
-
179
+
180
180
#[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
181
181
pub fn modified(&self) -> io::Result<SystemTime> {
182
182
- Ok(SystemTime::new(self.stat.st_mtime as i64, 0))
@@ -185,7 +185,7 @@ index bf49ad70590..ff01830e0f6 100644
185
185
+ tv_nsec: 0,
186
186
+ }))
187
187
}
188
-
188
+
189
189
#[cfg(target_os = "horizon")]
190
190
@@ -468,19 +430,18 @@ pub fn modified(&self) -> io::Result<SystemTime> {
191
191
target_os = "vita"
@@ -204,7 +204,7 @@ index bf49ad70590..ff01830e0f6 100644
204
204
+ tv_nsec: self.stat.st_atime_nsec as _,
205
205
+ }))
206
206
}
207
-
207
+
208
208
#[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))]
209
209
pub fn accessed(&self) -> io::Result<SystemTime> {
210
210
- Ok(SystemTime::new(self.stat.st_atime as i64, 0))
@@ -213,7 +213,7 @@ index bf49ad70590..ff01830e0f6 100644
213
213
+ tv_nsec: 0,
214
214
+ }))
215
215
}
216
-
216
+
217
217
#[cfg(target_os = "horizon")]
218
218
@@ -497,7 +458,10 @@ pub fn accessed(&self) -> io::Result<SystemTime> {
219
219
target_os = "watchos",
@@ -225,7 +225,7 @@ index bf49ad70590..ff01830e0f6 100644
225
225
+ tv_nsec: self.stat.st_birthtime_nsec as libc::c_long,
226
226
+ }))
227
227
}
228
-
228
+
229
229
#[cfg(not(any(
230
230
@@ -513,7 +477,10 @@ pub fn created(&self) -> io::Result<SystemTime> {
231
231
cfg_has_statx! {
@@ -244,7 +244,7 @@ index 17b4130c202..4e8dd9a86e7 100644
244
244
--- a/library/std/src/sys/unix/time.rs
245
245
+++ b/library/std/src/sys/unix/time.rs
246
246
@@ -36,6 +36,7 @@ pub(in crate::sys::unix) struct Timespec {
247
-
247
+
248
248
impl SystemTime {
249
249
#[cfg_attr(target_os = "horizon", allow(unused))]
250
250
+ #[cfg_attr(target_env = "gnu", allow(dead_code))]
0 commit comments