As of Node v8.10 millisecond and nanosecond resolution time is available as separate properties:
stats.mtimeMs
stats.ctimeMs
stats.atimeMs
i.e.
stats.mtime.getMillieseconds() //546
stats.mtimeMs // 1391354639546.3066
Question
The times returned by Node's fs.stat
seem to have one-second resolution even on file systems that support nanosecond resolution, like ext4.
var fs = require('fs')
var stats = fs.statSync('.')
stats.mtime.getMilliseconds() // => always 0
How do I get stat times with better resolution? Nanoseconds would be ideal, but milliseconds or microseconds is OK too.
La solution 2
As of Node v8.10 millisecond and nanosecond resolution time is available as separate properties:
stats.mtimeMs
stats.ctimeMs
stats.atimeMs
i.e.
stats.mtime.getMillieseconds() //546
stats.mtimeMs // 1391354639546.3066
Autres conseils