From cf6529985e4883709105344c45e88191df5df40c Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Mon, 23 Nov 2015 04:28:13 -0500 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig Reviewed-By: Minwoo Jung --- test/parallel/test-fs-utimes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index 49746bfbfb8bb5..2ad6cea4379b2e 100644 --- a/test/parallel/test-fs-utimes.js +++ b/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) {