Commit 09abd09ab8

Andrew Kelley <andrew@ziglang.org>
2019-10-17 00:13:40
add docs for std.fs.File.updateTimes
1 parent 6a549a7
Changed files (1)
lib
std
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);