Skip to content

Commit

Permalink
unix fs: Make hurd using explicit new rather than From
Browse files Browse the repository at this point in the history
408c0ea ("unix time module now return result") dropped the From
impl for SystemTime, breaking the hurd build (and probably the horizon
build)

Fixes #123032
  • Loading branch information
sthibaul committed Mar 25, 2024
1 parent 60b5ca6 commit 194ad3c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions library/std/src/sys/pal/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,16 @@ impl FileAttr {
SystemTime::new(self.stat.st_mtime as i64, 0)
}

#[cfg(any(target_os = "horizon", target_os = "hurd"))]
#[cfg(target_os = "horizon")]
pub fn modified(&self) -> io::Result<SystemTime> {
Ok(SystemTime::from(self.stat.st_mtim))
}

#[cfg(target_os = "hurd")]
pub fn modified(&self) -> io::Result<SystemTime> {
SystemTime::new(self.stat.st_mtim.tv_sec as i64, self.stat.st_mtim.tv_nsec as i64)
}

#[cfg(not(any(
target_os = "vxworks",
target_os = "espidf",
Expand All @@ -543,11 +548,16 @@ impl FileAttr {
SystemTime::new(self.stat.st_atime as i64, 0)
}

#[cfg(any(target_os = "horizon", target_os = "hurd"))]
#[cfg(target_os = "horizon")]
pub fn accessed(&self) -> io::Result<SystemTime> {
Ok(SystemTime::from(self.stat.st_atim))
}

#[cfg(target_os = "hurd")]
pub fn accessed(&self) -> io::Result<SystemTime> {
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
}

#[cfg(any(
target_os = "freebsd",
target_os = "openbsd",
Expand Down

0 comments on commit 194ad3c

Please sign in to comment.