pub struct UnixTimes {
pub mtime: Option<u64>,
pub atime: Option<u64>,
pub ctime: Option<u64>,
}Expand description
A snapshot of a file’s Unix timestamps, in seconds since 1970-01-01.
Every field is Option<u64> so partial sources (tar has only mtime) don’t
have to fabricate the others. When a field is None the destination
driver falls back to whatever it would use for a genuinely new file.
Fields§
§mtime: Option<u64>Modification time — the “when the content last changed” one, the
number ls -l and tar display. This is the field that matters
most; both dir_import and tar_import populate it.
atime: Option<u64>Access time — often equal to mtime on write. dir_import captures the host file’s atime; tar has no access-time field so tar_import leaves it None (driver falls back to mtime or now).
ctime: Option<u64>Metadata-change time — bumped by chmod / rename on POSIX. Almost never available at import time (tar doesn’t carry it, hosts don’t usually expose it portably), so this is usually None → driver uses mtime or now.
Implementations§
Source§impl UnixTimes
impl UnixTimes
Sourcepub fn all(secs: u64) -> Self
pub fn all(secs: u64) -> Self
Snapshot with all three fields set to the same value. What
dir_import uses when the host has only st_mtime to hand.
Sourcepub fn mtime_only(secs: u64) -> Self
pub fn mtime_only(secs: u64) -> Self
Snapshot with only mtime set. What tar_import produces (tar has no atime/ctime fields).
Sourcepub fn mtime_or_now(&self) -> u64
pub fn mtime_or_now(&self) -> u64
Convenience: mtime if set, else atime, else ctime, else now. The
pattern most drivers want when writing a single-field on-disk time
(e.g. UFS’s di_mtime only) — pick the most user-meaningful value
the caller supplied without overwriting it with now.
Sourcepub fn atime_or_now(&self) -> u64
pub fn atime_or_now(&self) -> u64
Convenience: atime if set, else mtime, else ctime, else now.
Sourcepub fn ctime_or_now(&self) -> u64
pub fn ctime_or_now(&self) -> u64
Convenience: ctime if set, else mtime, else atime, else now.