Skip to content

Commit ad86bc1

Browse files
ian-h-chamberlainAzureMarker
authored andcommitted
Update libc::stat field names
See Meziu/rust-horizon#14
1 parent c1dc4fa commit ad86bc1

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

std/src/os/horizon/fs.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,22 @@ impl MetadataExt for Metadata {
6969
self.as_inner().as_inner().st_size as u64
7070
}
7171
fn st_atime(&self) -> i64 {
72-
self.as_inner().as_inner().st_atime as i64
72+
self.as_inner().as_inner().st_atim.tv_sec
7373
}
7474
fn st_atime_nsec(&self) -> i64 {
75-
0
75+
self.as_inner().as_inner().st_atim.tv_nsec as i64
7676
}
7777
fn st_mtime(&self) -> i64 {
78-
self.as_inner().as_inner().st_mtime as i64
78+
self.as_inner().as_inner().st_mtim.tv_sec
7979
}
8080
fn st_mtime_nsec(&self) -> i64 {
81-
0
81+
self.as_inner().as_inner().st_mtim.tv_nsec as i64
8282
}
8383
fn st_ctime(&self) -> i64 {
84-
self.as_inner().as_inner().st_ctime as i64
84+
self.as_inner().as_inner().st_ctim.tv_sec
8585
}
8686
fn st_ctime_nsec(&self) -> i64 {
87-
0
87+
self.as_inner().as_inner().st_ctim.tv_nsec as i64
8888
}
8989
fn st_blksize(&self) -> u64 {
9090
self.as_inner().as_inner().st_blksize as u64

std/src/sys/unix/fs.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,16 @@ impl FileAttr {
429429
Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64))
430430
}
431431

432-
#[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon"))]
432+
#[cfg(any(target_os = "vxworks", target_os = "espidf"))]
433433
pub fn accessed(&self) -> io::Result<SystemTime> {
434434
Ok(SystemTime::new(self.stat.st_atime as i64, 0))
435435
}
436436

437+
#[cfg(target_os = "horizon")]
438+
pub fn accessed(&self) -> io::Result<SystemTime> {
439+
Ok(SystemTime::from(self.stat.st_atim))
440+
}
441+
437442
#[cfg(any(
438443
target_os = "freebsd",
439444
target_os = "openbsd",

0 commit comments

Comments
 (0)