add docs for std.fs.File.updateTimes

This commit is contained in:
Andrew Kelley 2019-10-16 18:13:40 -04:00
parent 6a549a7f0c
commit 09abd09ab8
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -269,9 +269,17 @@ pub const File = struct {
pub const UpdateTimesError = os.FutimensError || windows.SetFileTimeError;
/// `atime`: access timestamp in nanoseconds
/// `mtime`: last modification timestamp in nanoseconds
pub fn updateTimes(self: File, atime: i64, mtime: i64) UpdateTimesError!void {
/// The underlying file system may have a different granularity than nanoseconds,
/// and therefore this function cannot guarantee any precision will be stored.
/// Further, the maximum value is limited by the system ABI. When a value is provided
/// that exceeds this range, the value is clamped to the maximum.
pub fn updateTimes(
self: File,
/// access timestamp in nanoseconds
atime: i64,
/// last modification timestamp in nanoseconds
mtime: i64,
) UpdateTimesError!void {
if (windows.is_the_target) {
const atime_ft = windows.nanoSecondsToFileTime(atime);
const mtime_ft = windows.nanoSecondsToFileTime(mtime);