// Ex: // {stopwatch} // // ... //
This page was generated in {stopwatch} seconds
// // Call : $smarty->register_function('stopwatch', 'stopwatch', false); // note : Function may NOT be cached // function smarty_function_stopwatch($params, &$smarty){ static $mt_previous = 0; //list($usec, $sec) = explode(" ",microtime()); //$mt_current = (float)$usec + (float)$sec; $mt_current = (float) array_sum(explode(' ', microtime())); if (!$mt_previous) { $mt_previous = $mt_current; return ""; } else { $mt_diff = ($mt_current - $mt_previous); $mt_previous = $mt_current; return sprintf('%.4f',$mt_diff); } } ?>