Limit running time by an ENV variable

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

View File

@ -35,8 +35,12 @@ sub get_primes7($) {
return @res;
}
my $startTime = time();
my $periodTime = $ENV{'RUN_TIME'};
my @res;
while (1) {
while ((time() - $startTime) < $periodTime) {
@res = get_primes7(10000000);
print "Found ".(scalar @res)." prime numbers.\n";
}