WordPress.org

Make WordPress Core

Changeset 4174


Ignore:
Timestamp:
09/07/2006 11:26:52 PM (14 years ago)
Author:
ryan
Message:

timer_stop() wanted to be near timer_start().

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r4165 r4174  
    292292        ob_start('ob_gzhandler');
    293293    }
    294 }
    295 
    296 
    297 // functions to count the page generation time (from phpBB2)
    298 // ( or just any time between timer_start() and timer_stop() )
    299 
    300 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
    301     global $timestart, $timeend;
    302     $mtime = microtime();
    303     $mtime = explode(' ',$mtime);
    304     $mtime = $mtime[1] + $mtime[0];
    305     $timeend = $mtime;
    306     $timetotal = $timeend-$timestart;
    307     if ( $display )
    308         echo number_format($timetotal,$precision);
    309     return $timetotal;
    310294}
    311295
  • trunk/wp-settings.php

    r4160 r4174  
    5959    $timestart = $mtime;
    6060    return true;
     61}
     62
     63function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
     64    global $timestart, $timeend;
     65    $mtime = microtime();
     66    $mtime = explode(' ',$mtime);
     67    $mtime = $mtime[1] + $mtime[0];
     68    $timeend = $mtime;
     69    $timetotal = $timeend-$timestart;
     70    if ( $display )
     71        echo number_format($timetotal,$precision);
     72    return $timetotal;
    6173}
    6274timer_start();
Note: See TracChangeset for help on using the changeset viewer.