Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bpasero opened this issue Apr 9, 2018 · 5 comments
Closed
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@bpasero
Copy link
Contributor

bpasero commented Apr 9, 2018

  • 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).

@bpasero
Copy link
Contributor Author

bpasero commented Apr 9, 2018

Actually I can reproduce this also on macOS with ctime.

@ryzokuken
Copy link
Contributor

I don't know if it helps, but Node.js 7 has reached it's EOL. Are you sure it isn't just because of a change which was backported to LTS?

That said, I don't think breaking changes are backported.

@apapirovski
Copy link
Member

Probably a good idea to document if this did change.

/cc @nodejs/fs

@apapirovski apapirovski added the fs Issues and PRs related to the fs subsystem / file system. label Apr 12, 2018
@joyeecheung
Copy link
Member

Might be related to #11665

@apapirovski
Copy link
Member

While I think it would be nice to document this (if that's even the right thing to do), I'm also not optimistic about that happening given the amount of time this issue has been open. I'm going to close this out but if someone feels strongly, feel free to reopen and we can revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

4 participants