mirror of https://github.com/nodejs/node.git
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>pull/4163/head
parent
1d8c92e8b4
commit
cf6529985e
|
@ -23,7 +23,7 @@ function check_mtime(resource, mtime) {
|
||||||
var real_mtime = fs._toUnixTimestamp(stats.mtime);
|
var real_mtime = fs._toUnixTimestamp(stats.mtime);
|
||||||
// check up to single-second precision
|
// check up to single-second precision
|
||||||
// sub-second precision is OS and fs dependant
|
// 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) {
|
function expect_errno(syscall, resource, err, errno) {
|
||||||
|
|
Loading…
Reference in New Issue