1
0
mirror of https://github.com/danog/amp.git synced 2024-11-26 20:15:00 +01:00

Swap sign of returned time on 32-bit systems

This commit is contained in:
Aaron Piotrowski 2019-05-21 09:48:12 -05:00
parent 5dcdd83959
commit a4fd818e13
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -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;
}