note 56502 deleted from function.usleep by nlopess
| From: | nlopess@php.net | Date: | Fri, 30 Dec 2005 23:32:19 +0000 |
| Subject: | note 56502 deleted from function.usleep by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101021@lists.php.net to get a copy of this message | ||
Note Submitter: vsnake at list dot ru
----
See usefull function to delay with microseconds without processor overload on Win system.
function wait($usecs){
$temp = gettimeofday ();
$start = ($temp['sec'].'.'.str_repeat ('0', 6-strlen
($temp['usec']))) * 1000000;
while (1) {
$temp = gettimeofday ();
$stop = ($temp['sec'].'.'.str_repeat ('0', 6-strlen
($temp['usec']))) * 1000000;
if ($stop-$start >= $usecs) break;
}
}