diff options
| author | Ian Chamberlain <ian.h.chamberlain@gmail.com> | 2022-02-14 20:55:01 -0500 |
|---|---|---|
| committer | Mark Drobnak <mark.drobnak@gmail.com> | 2022-06-13 20:44:58 -0700 |
| commit | a49d14f08914390f24fa0ba6401b5f1de91939fc (patch) | |
| tree | 7e3e3c8f379287b21e69fa465d97181b52190c68 | |
| parent | 19f68a272912beaa68cb6c172e16ee6f21e96bf8 (diff) | |
| download | rust-a49d14f08914390f24fa0ba6401b5f1de91939fc.tar.gz rust-a49d14f08914390f24fa0ba6401b5f1de91939fc.zip | |
Update libc::stat field names
See https://github.com/Meziu/rust-horizon/pull/14
| -rw-r--r-- | library/std/src/os/horizon/fs.rs | 12 | ||||
| -rw-r--r-- | library/std/src/sys/unix/fs.rs | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/library/std/src/os/horizon/fs.rs b/library/std/src/os/horizon/fs.rs index a5a06764a4d..1325522105d 100644 --- a/library/std/src/os/horizon/fs.rs +++ b/library/std/src/os/horizon/fs.rs @@ -69,22 +69,22 @@ impl MetadataExt for Metadata { self.as_inner().as_inner().st_size as u64 } fn st_atime(&self) -> i64 { - self.as_inner().as_inner().st_atime as i64 + self.as_inner().as_inner().st_atim.tv_sec } fn st_atime_nsec(&self) -> i64 { - 0 + self.as_inner().as_inner().st_atim.tv_nsec as i64 } fn st_mtime(&self) -> i64 { - self.as_inner().as_inner().st_mtime as i64 + self.as_inner().as_inner().st_mtim.tv_sec } fn st_mtime_nsec(&self) -> i64 { - 0 + self.as_inner().as_inner().st_mtim.tv_nsec as i64 } fn st_ctime(&self) -> i64 { - self.as_inner().as_inner().st_ctime as i64 + self.as_inner().as_inner().st_ctim.tv_sec } fn st_ctime_nsec(&self) -> i64 { - 0 + self.as_inner().as_inner().st_ctim.tv_nsec as i64 } fn st_blksize(&self) -> u64 { self.as_inner().as_inner().st_blksize as u64 diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 4dda3c3f813..8b0bbd6a55c 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -429,11 +429,16 @@ impl FileAttr { Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64)) } - #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon"))] + #[cfg(any(target_os = "vxworks", target_os = "espidf"))] pub fn accessed(&self) -> io::Result<SystemTime> { Ok(SystemTime::new(self.stat.st_atime as i64, 0)) } + #[cfg(target_os = "horizon")] + pub fn accessed(&self) -> io::Result<SystemTime> { + Ok(SystemTime::from(self.stat.st_atim)) + } + #[cfg(any( target_os = "freebsd", target_os = "openbsd", |
