Function nix::sys::stat::utimensat

source ·
pub fn utimensat<P: ?Sized + NixPath>(
    dirfd: Option<RawFd>,
    path: &P,
    atime: &TimeSpec,
    mtime: &TimeSpec,
    flag: UtimensatFlags
) -> Result<()>
Expand description

Change the access and modification times of a file.

The file to be changed is determined relative to the directory associated with the file descriptor dirfd or the current working directory if dirfd is None.

If flag is UtimensatFlags::NoFollowSymlink and path names a symbolic link, then the mode of the symbolic link is changed.

utimensat(None, path, times, UtimensatFlags::FollowSymlink) is identical to utimes(path, times). The latter is a deprecated API so prefer using the former if the platforms you care about support it.

§References

utimensat(2).