Limit running time by an ENV variable

master
Ivan Zahariev 2016-09-08 17:44:06 +03:00
parent 17af67535b
commit 1320064fc3
1 changed files with 5 additions and 1 deletions

View File

@ -31,8 +31,12 @@ function get_primes7($n) {
return $res;
}
$startTime = time();
$periodTime = getenv('RUN_TIME');
$res = array();
while (1) {
while ((time() - $startTime) < $periodTime) {
$res = get_primes7(10000000);
print "Found ".count($res)." prime numbers.\n";
}