Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ext/standard/tests/hrtime/hrtime.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ This test frequently fails in CI
--FILE--
<?php

/* Busy-wait for a fixed amount of wall clock time instead of for a fixed
* number of iterations. The relative uncertainty checked below is dominated
* by scheduling jitter between the microtime() and hrtime() calls, so it is
* only meaningful once the measured interval is long enough to dwarf it. */
$m0 = microtime(true);
$h0 = hrtime(true);
for ($i = 0; $i < 1024*1024; $i++);
$h1 = hrtime(true);
do {
$h1 = hrtime(true);
} while ($h1 - $h0 < 100000000); /* 100ms */
$m1 = microtime(true);

$d0 = ($m1 - $m0)*1000000000.0;
Expand Down
Loading