Skip to content

Commit

Permalink
Swap sign of returned time on 32-bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed May 21, 2019
1 parent 4e82239 commit 57a201c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Internal/functions.php
Expand Up @@ -61,8 +61,10 @@ function getCurrentTime(): int
{
if (\PHP_VERSION_ID >= 70300) {
list($seconds, $nanoseconds) = \hrtime(false);
return $seconds * 1000 + $nanoseconds / 1000000;
$time = (int) ($seconds * 1000 + $nanoseconds / 1000000);
} else {
$time = (int) (\microtime(true) * 1000);
}

return (int) (\microtime(true) * 1000);
return $time < 0 ? -$time : $time;
}

0 comments on commit 57a201c

Please sign in to comment.