We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
SetFileTime
0xFFFF_FFFF_FFFF_FFFF
1 parent 39c0b00 commit c66860aCopy full SHA for c66860a
library/std/src/sys/windows/fs.rs
@@ -572,6 +572,14 @@ impl File {
572
"Cannot set file timestamp to 0",
573
));
574
}
575
+ let is_max =
576
+ |t: c::FILETIME| t.dwLowDateTime == c::DWORD::MAX && t.dwHighDateTime == c::DWORD::MAX;
577
+ if times.accessed.map_or(false, is_max) || times.modified.map_or(false, is_max) {
578
+ return Err(io::const_io_error!(
579
+ io::ErrorKind::InvalidInput,
580
+ "Cannot set file timestamp to 0xFFFF_FFFF_FFFF_FFFF",
581
+ ));
582
+ }
583
cvt(unsafe {
584
c::SetFileTime(self.as_handle(), None, times.accessed.as_ref(), times.modified.as_ref())
585
})?;
0 commit comments