silk.platform.windows.file_time.
Windows file metadata and timestamp helpers for cache maintenance and build fingerprinting.
When to use#
Use WindowsFileTime from cross-platform standard-library modules such as
silk.system.file_time to query file sizes, modification and status-change timestamps, or to
refresh modification times on Windows hosts without taking write-data access.
Details#
Single-call size and modification-time lookups use GetFileAttributesExW. Full modification
and change-time lookups open the path with FILE_READ_ATTRIBUTES, full sharing, and
FILE_FLAG_BACKUP_SEMANTICS and call GetFileInformationByHandleEx (FileBasicInfo).
Updating timestamps opens the path with FILE_WRITE_ATTRIBUTES, full sharing, and
FILE_FLAG_BACKUP_SEMANTICS (never GENERIC_WRITE) and calls SetFileTime.
Import as WindowsFileTime with import silk.platform.windows.file_time as WindowsFileTime.
Public declarations: 6.
WindowsFileMeta#
pub struct WindowsFileMetaLogical size, modification time, and directory flag read from one GetFileAttributesExW call.
Field bytes#
pub bytes: u64Logical byte length for regular files, or zero for directories.
Field modifiedSeconds#
pub modifiedSeconds: i64Last modification time in whole Unix seconds.
Field isDirectory#
pub isDirectory: boolTrue when the entry is a directory.
Implementation Copy for WindowsFileMeta#
impl Copy for WindowsFileMetaWindowsFileTimestamp#
pub struct WindowsFileTimestampOne file timestamp as whole Unix seconds and subsecond nanoseconds.
Field seconds#
pub seconds: i64Whole seconds since 1970-01-01T00:00:00Z.
Field nanoseconds#
pub nanoseconds: u32Nanoseconds after seconds, in the range 0 through 999999999.
Implementation Copy for WindowsFileTimestamp#
impl Copy for WindowsFileTimestampWindowsFileTimestamps#
pub struct WindowsFileTimestampsModification and status-change timestamps read from FILE_BASIC_INFO.
Field modified#
pub modified: WindowsFileTimestampLast data modification time (LastWriteTime).
Field changed#
pub changed: WindowsFileTimestampLast metadata or data change time (ChangeTime).
Implementation Copy for WindowsFileTimestamps#
impl Copy for WindowsFileTimestampsmeta#
pub effect fn meta(path: &Path) -> Option<WindowsFileMeta>Returns the size, last modification time, and directory flag of path using one
GetFileAttributesExW call, or None when the path cannot be queried.
timestamps#
pub effect fn timestamps(path: &Path) -> Option<WindowsFileTimestamps>Returns both the last-write and change timestamps of path using FileBasicInfo, or None
when the path cannot be opened or queried.
setModifiedSeconds#
pub effect fn setModifiedSeconds(path: &Path, seconds: i64) -> boolSets the last-access and last-write timestamps of path to whole Unix seconds. Opens the
entry with FILE_WRITE_ATTRIBUTES and full sharing so concurrent readers are never blocked.
Returns true when the timestamp update succeeds.
Category: Windows platform.
Profiles: x86_64-pc-windows-msvc.