From 30d93980799b7cbdede26d18c392acec3757e2b3 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 20 Aug 2009 18:38:17 +0200 Subject: [PATCH] MFB: Set timezone on logging (Bug #8496). --- framework/Core/lib/Horde.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 4c8bba582..5d3a46f6a 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -118,14 +118,18 @@ class Horde : null; $message = '[' . ($app ? $app : 'horde') . '] ' . $message . ' [pid ' . getmypid() . ' on line ' . $line . ' of "' . $file . '"]'; - /* Make sure to log in the system's locale. */ + /* Make sure to log in the system's locale and timezone. */ $locale = setlocale(LC_TIME, 0); setlocale(LC_TIME, 'C'); + $tz = getenv('TZ'); $logger->log($message, $priority); - /* Restore original locale. */ + /* Restore original locale and timezone. */ setlocale(LC_TIME, $locale); + if ($tz) { + @putenv('TZ=' . $tz); + } return true; } -- 2.11.0