commit 09abd09ab85189b15c3296407a5a8a803e93ebd0 (tree)
parent 6a549a7f0cc337634c5dca6abf20eca53b572f21
Author: Andrew Kelley <andrew@ziglang.org>
Date: Wed, 16 Oct 2019 18:13:40 -0400
add docs for std.fs.File.updateTimes
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig
@@ -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);