Author: marco
Date: Sat Jan 14 08:48:54 2006
New Revision: 369045

URL: http://svn.apache.org/viewcvs?rev=369045&view=rev
Log:
Added private static startTime var.

Modified:
    logging/log4php/trunk/src/php5/log4php/spi/LoggerLoggingEvent.php

Modified: logging/log4php/trunk/src/php5/log4php/spi/LoggerLoggingEvent.php
URL: 
http://svn.apache.org/viewcvs/logging/log4php/trunk/src/php5/log4php/spi/LoggerLoggingEvent.php?rev=369045&r1=369044&r2=369045&view=diff
==============================================================================
--- logging/log4php/trunk/src/php5/log4php/spi/LoggerLoggingEvent.php (original)
+++ logging/log4php/trunk/src/php5/log4php/spi/LoggerLoggingEvent.php Sat Jan 
14 08:48:54 2006
@@ -31,6 +31,8 @@
  * @subpackage spi 
  */
 class LoggerLoggingEvent {
+       
+       private static $startTime;
 
     /** 
     * @var string Fully Qualified Class Name of the calling category class.
@@ -107,7 +109,7 @@
     * was created plus microseconds if available.
     * @var float
     */
-    var $timeStamp;
+    public $timeStamp;
     
     /** 
     * @var LoggerLocationInfo Location information for the caller. 
@@ -133,18 +135,18 @@
             $this->logger = $logger;
             $this->categoryName = $logger->getName();
         } else {
-            $this->categoryName = (string)$logger;
+            $this->categoryName = strval($logger);
         }
         $this->level = $priority;
         $this->message = $message;
-        if ($timeStamp !== null and is_float($timeStamp)) {
+        if ($timeStamp !== null && is_float($timeStamp)) {
             $this->timeStamp = $timeStamp;
         } else {
             if (function_exists('microtime')) {
                                // get microtime as float
                 $this->timeStamp = microtime(true);
             } else {
-                $this->timeStamp = time();
+                $this->timeStamp = floatval(time());
             }
         }
     }
@@ -295,19 +297,16 @@
      * @return float
      * @static
      */
-    public function getStartTime()
-    {
-        static $startTime;
-        
-        if (!isset($startTime)) {
+    public static function getStartTime() {
+        if (!isset(self::$startTime)) {
             if (function_exists('microtime')) {
                // microtime as float
-                $startTime = microtime(true);
+                self::$startTime = microtime(true);
             } else {
-                $startTime = time();
+                self::$startTime = floatval(time());
             }
         }
-        return $startTime; 
+        return self::$startTime; 
     }
     
     /**


Reply via email to