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
@@ -25,7 +25,7 @@ if ($res instanceof \Traversable) {
$colorCli->header('Updating console info for '.number_format($res->rowCount()).' releases.');
foreach ($res as $arr) {
$starttime = microtime(true);
$starttime = now()->timestamp;
$gameInfo = $console->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
$game = $console->updateConsoleInfo($gameInfo);
@@ -35,7 +35,7 @@ if ($res instanceof \Traversable) {
}
// amazon limits are 1 per 1 sec
$diff = floor((microtime(true) - $starttime) * 1000000);
$diff = floor((now()->timestamp - $starttime) * 1000000);
if (1000000 - $diff > 0) {
$colorCli->alternate('Sleeping');
usleep(1000000 - $diff);