Browse Source

test: fix time resolution constraint

The modification time of a file is assumed to happen at the
exact time when it was requested. As the utime API specification
delcares that the resolution of the result is 1 second,
relax the constrain to 1 second helps the test case to be
robust and consistent under different load conditions in the system

PR-URL: https://github.com/nodejs/node/pull/3981
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
v4.x
Gireesh Punathil 9 years ago
committed by Myles Borins
parent
commit
3f0ff879cf
  1. 2
      test/parallel/test-fs-utimes.js

2
test/parallel/test-fs-utimes.js

@ -23,7 +23,7 @@ function check_mtime(resource, mtime) {
var real_mtime = fs._toUnixTimestamp(stats.mtime);
// check up to single-second precision
// sub-second precision is OS and fs dependant
return Math.floor(mtime) == Math.floor(real_mtime);
return mtime - real_mtime < 2;
}
function expect_errno(syscall, resource, err, errno) {

Loading…
Cancel
Save