1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 00:56:08 +02:00

Fix microseconds support on 7.1, and enable it by default as 7.1 has no perf cost anymore

This commit is contained in:
Jordi Boggiano
2016-11-14 11:53:15 +01:00
parent 9691bde77a
commit 4a43d9b17c
4 changed files with 16 additions and 8 deletions

View File

@@ -23,10 +23,12 @@ class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable
public function __construct($useMicroseconds, \DateTimeZone $timezone = null)
{
static $needsMicrosecondsHack = PHP_VERSION_ID < 70100;
$this->useMicroseconds = $useMicroseconds;
$date = 'now';
if ($useMicroseconds) {
if ($needsMicrosecondsHack && $useMicroseconds) {
$timestamp = microtime(true);
// apply offset of the timezone as microtime() is always UTC