Skip to content

fs.Stats mtime/atime/ctime rounding differences between node.js 7.x and 8.x #19897

@bpasero

Description

@bpasero
  • Version: 8.11.1
  • Platform: Windows (64 bits)
  • Subsystem: Windows 10

It looks like node.js 8.x introduced higher precision for the times returned in fs.Stats (e.g. fs.statSync). I can see rounding differences when comparing the result from node.js 7.x to 8.x which I was not expecting. Steps:

  • have a folder which mtime would round up to the next millisecond (e.g. 1494910432092.7104)
  • node.js 8.x returns 1494910432093 for Number(fs.Stats.mtime)
  • node.js 7.x returns 1494910432092

I would argue the 8.x behaviour is probably the expected one but I was not seeing this as a breaking change in the release notes so it should maybe be documented. If you store these times in some DB with node.js 7.x and then update to 8.x the comparisons are not working anymore (this is how I noticed it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions