summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Guo <dannyguo91@gmail.com>2016-09-18 15:47:27 -0400
committerJames M Snell <jasnell@gmail.com>2016-09-20 11:11:01 -0700
commit99ab686cd3684b965e40e85f96d089f8ef437fa1 (patch)
treec649e54eb45ff84bef3344229bbcc4e773fb46e3
parent41a66bc73a547f5b628c92b6468cc1abcb92ba84 (diff)
downloadnode-new-99ab686cd3684b965e40e85f96d089f8ef437fa1.tar.gz
doc: clarify fs.utimes() arguments
Make it clear that atime and mtime should be in seconds. PR-URL: https://github.com/nodejs/node/pull/8651 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
-rw-r--r--doc/api/fs.md16
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 2b9369ffa3..99e23e7a5a 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -1438,7 +1438,7 @@ added: v0.1.31
Asynchronous realpath(3). The `callback` gets two arguments `(err,
resolvedPath)`. May use `process.cwd` to resolve relative paths.
-Only paths that can be converted to UTF8 strings are supported.
+Only paths that can be converted to UTF8 strings are supported.
The optional `options` argument can be a string specifying an encoding, or an
object with an `encoding` property specifying the character encoding to use for
@@ -1637,13 +1637,15 @@ added: v0.4.2
Change file timestamps of the file referenced by the supplied path.
-Note: the arguments `atime` and `mtime` of the following related functions does
-follow the below rules:
+Note: the arguments `atime` and `mtime` of the following related functions
+follow these rules:
-- If the value is a numberable string like `'123456789'`, the value would get
- converted to corresponding number.
-- If the value is `NaN` or `Infinity`, the value would get converted to
- `Date.now()`.
+- The value should be a Unix timestamp in seconds. For example, `Date.now()`
+ returns milliseconds, so it should be divided by 1000 before passing it in.
+- If the value is a numeric string like `'123456789'`, the value will get
+ converted to the corresponding number.
+- If the value is `NaN` or `Infinity`, the value will get converted to
+ `Date.now() / 1000`.
## fs.utimesSync(path, atime, mtime)
<!-- YAML