]> granicus.if.org Git - php/commitdiff
Add some tolerance to time_sleep_until() test
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 1 Jul 2019 07:43:16 +0000 (09:43 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 1 Jul 2019 07:43:16 +0000 (09:43 +0200)
This has been sporadically failing on macos for a while. We've tried
a couple of things (using int arithmetic, normalizing to gettimeofday),
but this issue remains. I'm adding some tolerance to the test to
avoid CI failures.

ext/standard/tests/misc/time_sleep_until_basic.phpt

index 25c17ab9a775da3ba7b01e92d2b9dfc257483235..b0d3c8eea5f1524acd84001861ec21d6c5ba1a8e 100644 (file)
@@ -29,7 +29,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
     $now = $tmp >= (int)$time ? $tmp : $tmp + .05;
 }
 
-if ($now >= $sleepUntil) {
+// Add some tolerance for early wake on macos. Reason unknown.
+if ($now + 0.001 >= $sleepUntil) {
     echo "Success\n";
 } else {
     echo "Sleep until (before truncation): ", $time, "\n";