Skip to content

Commit 4db2181

Browse files
committed
make this test a bit more tolerant when checking sleep time
1 parent 99fb5d0 commit 4db2181

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎ext/pdo_pgsql/tests/getnotify.phpt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
7070
// Test second parameter, should wait 2 seconds because no notify is queued
7171
$t = microtime(1);
7272
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
73-
var_dump((microtime(1) - $t) >= 1);
73+
$diff = microtime(1) - $t;
74+
var_dump($diff >= 1 || 1 - abs($diff) < .01);
7475
var_dump($notify);
7576

7677
// Test second parameter, should return immediately because a notify is queued
7778
$db->exec("NOTIFY notifies_phpt");
7879
$t = microtime(1);
7980
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
80-
var_dump((microtime(1) - $t) < 1);
81+
$diff = microtime(1) - $t;
82+
var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
8183
var_dump(count($notify));
8284

8385
?>

0 commit comments

Comments
 (0)