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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
  • Loading branch information
gireeshpunathil authored and Myles Borins committed Jan 19, 2016
1 parent 22b88e1 commit 3f0ff87
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 3f0ff87

Please sign in to comment.