Skip to content

Commit

Permalink
test: fix time resolution constraint
Browse files Browse the repository at this point in the history
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 <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
  • Loading branch information
gireeshpunathil authored and JungMinu committed Dec 5, 2015
1 parent 1d8c92e commit cf65299
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/parallel/test-fs-utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cf65299

Please sign in to comment.