what about sleep() ?

OjMyStEr wrote:
Hi,
Does anyone know if there is a way for me to produce a function in PHP to
pause the processing of the script for 3 seconds for example without eating
up the CPU bandwidth. I could do with quite accurate control. Is there a
better way that doing it like this:

<?php

function pause_script($int){
 $start_time = time();
 while(time() <= ($start_time+$int)){
    // No functions take place inside the loop!
 }
}

echo "The current time is " . time() . "\n";
pause_script(10);
echo "The current time is " . time() . "\n";

?>

The output is:
The current time is 1044105730
The current time is 1044105741

There is obviously an 11 second difference is the time that the two seperate
lines were printed.
Thing is, when I run this script the CPU usage goes to 100%

Anyone got any ideas?

Thanx

Josh





--
IPv6 + TCPA + wrecked Palladium server = NO COFFE!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to