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

Support 32-bit platforms

This commit is contained in:
Niklas Keller 2019-05-31 19:48:32 +02:00 committed by Aaron Piotrowski
parent 5316e741b7
commit 8b38da2f9c
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -61,22 +61,24 @@ function getCurrentTime(): int
{
static $startTime;
if (\PHP_VERSION_ID >= 70300) {
list($seconds, $nanoseconds) = \hrtime(false);
$now = $seconds * 1000 + $nanoseconds / 1000000;
} else {
$now = \microtime(true) * 1000;
}
$time = (int) $now;
if ($time < 0) {
if (\PHP_INT_SIZE === 4) {
if ($startTime === null) {
$startTime = $now;
$startTime = \PHP_VERSION_ID >= 70300 ? \hrtime(false)[0] : \time();
}
$time = (int) ($now - $startTime);
if (\PHP_VERSION_ID >= 70300) {
list($seconds, $nanoseconds) = \hrtime(false);
$seconds -= $startTime;
return (int) ($seconds * 1000 + $nanoseconds / 1000000);
}
return ((\microtime(true) - $startTime) * 1000);
}
return $time;
if (\PHP_VERSION_ID >= 70300) {
list($seconds, $nanoseconds) = \hrtime(false);
return (int) ($seconds * 1000 + $nanoseconds / 1000000);
}
return (\microtime(true) * 1000);
}