Skip to content

Commit

Permalink
Merge pull request #39 from apankov/master
Browse files Browse the repository at this point in the history
Fixing bug how execution time is calculated
  • Loading branch information
sofadesign committed Mar 11, 2013
2 parents d0d5b9c + ad8dc89 commit 5665491
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/example01/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function image_show_jpeg_only()

function after($output, $route)
{
$time = number_format( (float)substr(microtime(), 0, 10) - LIM_START_MICROTIME, 6);
$time = number_format( microtime(true) - LIM_START_MICROTIME, 6);
$output .= "\n<!-- page rendered in $time sec., on ".date(DATE_RFC822)." -->\n";
$output .= "<!-- for route\n";
$output .= print_r($route, true);
Expand Down
2 changes: 1 addition & 1 deletion examples/example03/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function before($route = array())

function after($output, $route)
{
$time = number_format( (float)substr(microtime(), 0, 10) - LIM_START_MICROTIME, 6);
$time = number_format( microtime(true) - LIM_START_MICROTIME, 6);
$output .= "\n<!-- page rendered in $time sec., on ".date(DATE_RFC822)." -->\n";
$output .= "<!-- for route\n";
$output .= print_r($route, true);
Expand Down
6 changes: 3 additions & 3 deletions lib/limonade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/
define('LIMONADE', '0.5.0');
define('LIM_NAME', 'Un grand cru qui sait se faire attendre');
define('LIM_START_MICROTIME', (float)substr(microtime(), 0, 10));
define('LIM_START_MICROTIME', microtime(true));
define('LIM_SESSION_NAME', 'LIMONADE'.str_replace('.','x',LIMONADE));
define('LIM_SESSION_FLASH_KEY', '_lim_flash_messages');
if(function_exists('memory_get_usage'))
Expand Down Expand Up @@ -1837,8 +1837,8 @@ function end_content_for()
*/
function benchmark()
{
$res = array( 'execution_time' => (microtime() - LIM_START_MICROTIME) );
if(defined('LIM_START_MEMORY'))
$res = array( 'execution_time' => (microtime(true) - LIM_START_MICROTIME) );
if(defined('LIM_START_MEMORY'))
{
$current_mem_usage = memory_get_usage();
$res['current_memory'] = $current_mem_usage;
Expand Down

0 comments on commit 5665491

Please sign in to comment.