使用毫秒單位來進行計算程序執行時間

需要精確計算程序執行時間時,可以使用毫秒單位來進行計算:

step1

//獲取當前時間毫秒
function msectime()
{
    list($msec, $sec) = explode(' ', microtime());
    $msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
    return $msectime;
}

step2 


$time = msectime();
$ts = date('YmdHis').substr($time, -3);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章