Skip to content

Commit 194ad3c

Browse files
committed
unix fs: Make hurd using explicit new rather than From
408c0ea ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd build (and probably the horizon build) Fixes #123032
1 parent 60b5ca6 commit 194ad3c

File tree

1 file changed

+12
-2
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+12
-2
lines changed

library/std/src/sys/pal/unix/fs.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,16 @@ impl FileAttr {
515515
SystemTime::new(self.stat.st_mtime as i64, 0)
516516
}
517517

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

523+
#[cfg(target_os = "hurd")]
524+
pub fn modified(&self) -> io::Result<SystemTime> {
525+
SystemTime::new(self.stat.st_mtim.tv_sec as i64, self.stat.st_mtim.tv_nsec as i64)
526+
}
527+
523528
#[cfg(not(any(
524529
target_os = "vxworks",
525530
target_os = "espidf",
@@ -543,11 +548,16 @@ impl FileAttr {
543548
SystemTime::new(self.stat.st_atime as i64, 0)
544549
}
545550

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

556+
#[cfg(target_os = "hurd")]
557+
pub fn accessed(&self) -> io::Result<SystemTime> {
558+
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
559+
}
560+
551561
#[cfg(any(
552562
target_os = "freebsd",
553563
target_os = "openbsd",

0 commit comments

Comments
 (0)