note 19923 added to function.usleep
| From: | dsc at c2i dot net | Date: | Fri, 15 Mar 2002 02:55:55 +0000 |
| Subject: | note 19923 added to function.usleep | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27822@lists.php.net to get a copy of this message | ||
The usleep() for Windows above doesn't take into account that the value of $stop can be lower
than $start. It also contains unnecessary casts and $temp variable. Here is a better function:
function usleepWindows($usec)
{
$start = gettimeofday();
do
{
$stop = gettimeofday();
$timePassed = 1000000 * ($stop['sec'] - $start['sec'])
+ $stop['usec'] - $start['usec'];
}
while ($timePassed < $usec);
}
--
http://www.php.net/manual/en/function.usleep.php
http://master.php.net/manage/user-notes.php?action=edit+19923
http://master.php.net/manage/user-notes.php?action=delete+19923
http://master.php.net/manage/user-notes.php?action=reject+19923