Sleep Function
| From: | Josh Seward | Date: | Mon, 12 Mar 2001 13:54:11 +0000 |
| Subject: | Sleep Function | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-698@lists.php.net to get a copy of this message | ||
I have been having tourble with boht the sleep and usleep function. I can only get them to 40
sec and then they will cut off. This is even true with the micro seconds in the usleep function.
Here is my code:
do{
$hour = date("G");
$minute = date("i");
$sec = date("s");
print "$hour:$minute:$sec\n";
usleep(100); // or us sleep(1);
}while($minute != "00");
This will stop on the 40th sec. Its not the 40th loop becuase usleep loops hundreds of times but
only quite on the 40th second.
I am trying to set up a program to run every hour and this loop finds the hour on the hour then
continues to run.Incase someone starts the script say at 7:30. It will wait till 8:00 to run the
rest of the script. If there is a better way to do this please tell!!!!
Thanks,
Josh Seward
js389599@ohiou.edu