note 8497 deleted from function.usleep by nlopess
| From: | nlopess@php.net | Date: | Fri, 30 Dec 2005 23:30:20 +0000 |
| Subject: | note 8497 deleted from function.usleep by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101020@lists.php.net to get a copy of this message | ||
Note Submitter: beidson at calpoly dot edu
----
Since USLEEP doesn't work under windows, you need to come up with your own fix. This little
function will do the trick.
function wait($usecs){
$temp=gettimeofday();
$start=(int)$temp["usec"];
while(1){
$temp=gettimeofday();
$stop=(int)$temp["usec"];
if ($stop-$start >= $usecs) break;
}
}
The smallest amount of time it seems to work with is around 200usecs, but if you wait() anything
higher than 200usecs it's pretty close.