统计时间值


¥Stat time values

atimeMsmtimeMsctimeMsbirthtimeMs 属性是数值,以毫秒为单位保存相应的时间。它们的精度是特定于平台的。当 bigint: true 被传递到生成对象的方法中时,属性将是 bigints,否则它们将是 numbers

¥The atimeMs, mtimeMs, ctimeMs, birthtimeMs properties are numeric values that hold the corresponding times in milliseconds. Their precision is platform specific. When bigint: true is passed into the method that generates the object, the properties will be bigints, otherwise they will be numbers.

atimeNsmtimeNsctimeNsbirthtimeNs 属性是 bigints,以纳秒为单位保存相应的时间。它们仅在 bigint: true 传入到生成对象的方法中时出现。它们的精度是特定于平台的。

¥The atimeNs, mtimeNs, ctimeNs, birthtimeNs properties are bigints that hold the corresponding times in nanoseconds. They are only present when bigint: true is passed into the method that generates the object. Their precision is platform specific.

atimemtimectimebirthtime 是不同时间的 Date 对象替代表示。Date 和数字值是不关联的。分配新的数值或改变 Date 值不会反映在相应的替代表示中。

¥atime, mtime, ctime, and birthtime are Date object alternate representations of the various times. The Date and number values are not connected. Assigning a new number value, or mutating the Date value, will not be reflected in the corresponding alternate representation.

统计对象中的时间具有以下语义:

¥The times in the stat object have the following semantics:

  • atime "访问时间":上次访问文件数据的时间。由 mknod(2)、utimes(2) 和 read(2) 系统调用更改。

    ¥atime "Access Time": Time when file data last accessed. Changed by the mknod(2), utimes(2), and read(2) system calls.

  • mtime "修改时间":上次修改文件数据的时间。由 mknod(2)、utimes(2) 和 write(2) 系统调用更改。

    ¥mtime "Modified Time": Time when file data last modified. Changed by the mknod(2), utimes(2), and write(2) system calls.

  • ctime "更改时间":上次更改文件状态的时间(inode 数据修改)。由 chmod(2)、chown(2)、link(2)、mknod(2)、rename(2)、unlink(2)、utimes(2)、read(2) 和 write(2) 系统调用更改 。

    ¥ctime "Change Time": Time when file status was last changed (inode data modification). Changed by the chmod(2), chown(2), link(2), mknod(2), rename(2), unlink(2), utimes(2), read(2), and write(2) system calls.

  • birthtime "出生时间":文件创建时间。创建文件时设置一次。在出生时间不可用的文件系统上,此字段可能会保存 ctime1970-01-01T00:00Z(即 Unix 纪元时间戳 0)。在这种情况下,该值可能大于 atimemtime。在 Darwin 和其他 FreeBSD 变体上,如果使用 utimes(2) 系统调用将 atime 显式设置为比当前 birthtime 更早的值,则还要进行设置。

    ¥birthtime "Birth Time": Time of file creation. Set once when the file is created. On file systems where birthtime is not available, this field may instead hold either the ctime or 1970-01-01T00:00Z (ie, Unix epoch timestamp 0). This value may be greater than atime or mtime in this case. On Darwin and other FreeBSD variants, also set if the atime is explicitly set to an earlier value than the current birthtime using the utimes(2) system call.

在 Node.js 0.12 之前,ctime 是 Windows 系统上的 birthtime。从 0.12 开始,ctime 不是 "创建时间",在 Unix 系统上,它从来不是。

¥Prior to Node.js 0.12, the ctime held the birthtime on Windows systems. As of 0.12, ctime is not "creation time", and on Unix systems, it never was.