Si estas usando funciones entonces usalo de esta manera,
Código PHP:
<?
function get_time()
{
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$tiempoinicial = $mtime;
return $tiempoinicial;
}
//========================
//AQUI TU CONSULTA
//========================
function calculate_time()
{
$get_time = get_time();
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$tiempofinal = $mtime;
$tiempototal = ($tiempofinal - $get_time);
echo "La cosulta se realizo en $tiempototal segundos";
}
calculate_time();
?>
Saludos.-