Skip to content

Commit cf65299

Browse files
gireeshpunathilJungMinu
authored andcommitted
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: #3981 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent 1d8c92e commit cf65299

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-fs-utimes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function check_mtime(resource, mtime) {
2323
var real_mtime = fs._toUnixTimestamp(stats.mtime);
2424
// check up to single-second precision
2525
// sub-second precision is OS and fs dependant
26-
return Math.floor(mtime) == Math.floor(real_mtime);
26+
return mtime - real_mtime < 2;
2727
}
2828

2929
function expect_errno(syscall, resource, err, errno) {

0 commit comments

Comments
 (0)