Dotclear

Changeset 2595:84b6d63767f6


Ignore:
Timestamp:
11/29/13 09:23:08 (12 years ago)
Author:
Dsls
Branch:
default
Message:

Added dcCore::stime and dcCore::getElapsedTime, closes #1892

Location:
inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.core.php

    r2577 r2595  
    3939     public $rest;       ///< <b>dcRestServer</b> dcRestServer object 
    4040     public $log;        ///< <b>dcLog</b>             dcLog object 
     41     public $stime;      ///< <b>float</b>             starting time 
    4142 
    4243     private $versions = null; 
     
    5960     public function __construct($driver, $host, $db, $user, $password, $prefix, $persist) 
    6061     { 
     62          if (defined('DC_START_TIME')) { 
     63               $this->stime=DC_START_TIME; 
     64          } else { 
     65               $this->stime = microtime(true); 
     66          } 
     67 
    6168          $this->con = dbLayer::init($driver,$host,$db,$user,$password,$persist); 
    6269 
     
    14711478          } 
    14721479     } 
     1480 
     1481     /** 
     1482      Return elapsed time since script has been started 
     1483      @param   $mtime <b>float</b> timestamp (microtime format) to evaluate delta from 
     1484                                     current time is taken if null 
     1485      @return <b>float</b>        elapsed time 
     1486      */ 
     1487     public function getElapsedTime ($mtime=null) { 
     1488          if ($mtime !== null) { 
     1489               return $mtime-$this->stime; 
     1490          } else { 
     1491               return microtime(true)-$this->stime; 
     1492          } 
     1493     } 
    14731494     //@} 
     1495 
     1496 
     1497 
    14741498} 
  • inc/prepend.php

    r2567 r2595  
    1010# 
    1111# -- END LICENSE BLOCK ----------------------------------------- 
     12 
     13/* Start tick  */ 
     14define('DC_START_TIME',microtime(true)); 
    1215 
    1316/* ------------------------------------------------------------------------------------------- */ 
Note: See TracChangeset for help on using the changeset viewer.

Sites map