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:
parent
5316e741b7
commit
8b38da2f9c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user