]> granicus.if.org Git - php/commitdiff
make this test a bit more tolerant when checking sleep time
authorAnatol Belski <ab@php.net>
Fri, 12 Sep 2014 12:03:06 +0000 (14:03 +0200)
committerAnatol Belski <ab@php.net>
Fri, 12 Sep 2014 12:39:19 +0000 (14:39 +0200)
ext/pdo_pgsql/tests/getnotify.phpt

index c093e0357a5df2b27592782dc61df2a7da9013cb..c54a31604d7bb79c82543e35529107746f9ce0b0 100644 (file)
@@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
 // Test second parameter, should wait 2 seconds because no notify is queued
 $t = microtime(1);
 $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
-var_dump((microtime(1) - $t) >= 1);
+$diff = microtime(1) - $t;
+var_dump($diff >= 1 || 1 - abs($diff) < .01);
 var_dump($notify);
 
 // Test second parameter, should return immediately because a notify is queued
 $db->exec("NOTIFY notifies_phpt");
 $t = microtime(1);
 $notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
-var_dump((microtime(1) - $t) < 1);
+$diff = microtime(1) - $t;
+var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
 var_dump(count($notify));
 
 ?>