本文整理匯總了PHP中Timer::timer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Timer::timer方法的具體用法?PHP Timer::timer怎麽用?PHP Timer::timer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Timer
的用法示例。
在下文中一共展示了Timer::timer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testTimer
/**
* Tests the timer function.
*
* Originally the usleep() function took the $i variable as the number of miliseconds.
* However because the real time the script execution is halted is not exactly the
* number of miliseconds given (sometimes slightly less, but enough to make the assertion
* fail), we multiply the sleep time by 1.1 just to be sure.
*/
public function testTimer()
{
Timer::timer();
for ($i = 100; $i < 1000000; $i *= 10) {
usleep($i * 1.1);
$delta = Timer::timer();
$this->assertGreaterThan($i / 1000000, $delta);
}
}