Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

File timestamp resolution is inconsistent with fs.stat / fs.utimes #7000

@RustyMarvin

Description

@RustyMarvin

In node 0.11.11 under windows 7
the file timestamp resolution of fs.stat seems to be 1 millisecond, but if i try to set the timestamps, the resolution seems to be only 1 second. This is inconsistent.

> process.version
'v0.11.11'
> fs.writeFileSync('test.txt', 'abc');
undefined
> fs.statSync('test.txt').mtime.getTime();
1391100066267
> fs.utimesSync('test.txt', new Date(1356171132123), new Date(1356171132123));
undefined
> fs.statSync('test.txt').mtime.getTime();
1356171132000

In node 0.10 the resolution seems to be always 1 second.

> process.version
'v0.10.23'
> fs.writeFileSync('test.txt', 'abc');
undefined
> fs.statSync('test.txt').mtime.getTime();
1391100029000
> fs.utimesSync('test.txt', new Date(1356171132123), new Date(1356171132123));
undefined
> fs.statSync('test.txt').mtime.getTime();
1356171132000

I think the resolution should be either 1 second or 1 millisecond, but not mixed.
The timestamp resolution of the underlying windows filesystem NTFS is 100 nanoseconds, so both solutions would be fine ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions