Skip to content

Loading…

Save some I/O #127

Merged
merged 1 commit into from

2 participants

@rande

Add the timezone in the the \DateTime constructor. While the DateTime object

is initialized without the DateTimeZone instance, the underline library
execute a stat('.../Europe/Paris') to check if the OS knows the timezone.

This will improve performance on long run process by avoiding unless i/o calls.

@rande rande Add the timezone in the the \DateTime constructor. While the DateTime…
… object

is initialized without the DateTimeZone instance, the underline library
execute a stat('.../Europe/Paris') to check if the OS knows the timezone.

This will improve performance on long run process by avoiding unless i/o calls.
5e0fabe
@Seldaek Seldaek merged commit 38bb472 into Seldaek:master
@Seldaek
Owner

Merged thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 24, 2012
  1. @rande

    Add the timezone in the the \DateTime constructor. While the DateTime…

    rande committed
    … object
    
    is initialized without the DateTimeZone instance, the underline library
    execute a stat('.../Europe/Paris') to check if the OS knows the timezone.
    
    This will improve performance on long run process by avoiding unless i/o calls.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Monolog/Logger.php
View
4 src/Monolog/Logger.php
@@ -191,7 +191,7 @@ public function addRecord($level, $message, array $context = array())
'level' => $level,
'level_name' => static::getLevelName($level),
'channel' => $this->name,
- 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)))->setTimeZone(static::$timezone),
+ 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
'extra' => array(),
);
// check if any handler will handle this message
@@ -339,7 +339,7 @@ public function isHandling($level)
'level' => $level,
'level_name' => static::getLevelName($level),
'channel' => $this->name,
- 'datetime' => new \DateTime(),
+ 'datetime' => new \DateTime('now', static::$timezone),
'extra' => array(),
);
Something went wrong with that request. Please try again.