Use now() helper for calculating scripts runtime

This commit is contained in:
DariusIII
2018-11-29 20:49:20 +01:00
parent 529b9ce731
commit 2dad4ee96e
12 changed files with 34 additions and 33 deletions
+2 -2
View File
@@ -13,11 +13,11 @@ $movies = DB::select('SELECT title FROM xxxinfo WHERE cover = 0');
echo $c->primary('Updating '.number_format(\count($movies)).' XXX movie covers.');
foreach ($movies as $mov) {
$starttime = microtime(true);
$starttime = now()->timestamp;
$mov = $movie->updateXXXInfo($mov->title);
// sleep so that it's not ddos' the site
$diff = floor((microtime(true) - $starttime) * 1000000);
$diff = floor((now()->timestamp - $starttime) * 1000000);
if (333333 - $diff > 0) {
echo "\nsleeping\n";
usleep(333333 - $diff);