1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-20 16:16:37 +02:00

Fix PHP7.1 DateTime support

This commit is contained in:
Jordi Boggiano
2016-11-17 11:23:34 +01:00
parent 9d43c66cc6
commit 8f47e12463
2 changed files with 3 additions and 2 deletions

View File

@@ -311,7 +311,8 @@ class Logger implements LoggerInterface
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
}
if ($this->microsecondTimestamps) {
// php7.1+ always has microseconds enabled, so we do not need this hack
if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) {
$ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone);
} else {
$ts = new \DateTime(null, static::$timezone);