Ask for a float from microtime() for timer_start(), timer_stop(). Clarify docs. props solarissmoke, fixes #19157.

git-svn-id: https://develop.svn.wordpress.org/trunk@19611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2011-12-20 21:36:53 +00:00
parent 0180cd8072
commit fa9f927d75
2 changed files with 9 additions and 16 deletions
+3 -7
View File
@@ -1441,8 +1441,7 @@ class wpdb {
* @return true
*/
function timer_start() {
$mtime = explode( ' ', microtime() );
$this->time_start = $mtime[1] + $mtime[0];
$this->time_start = microtime( true );
return true;
}
@@ -1451,13 +1450,10 @@ class wpdb {
*
* @since 1.5.0
*
* @return int Total time spent on the query, in milliseconds
* @return float Total time spent on the query, in seconds
*/
function timer_stop() {
$mtime = explode( ' ', microtime() );
$time_end = $mtime[1] + $mtime[0];
$time_total = $time_end - $this->time_start;
return $time_total;
return ( microtime( true ) - $this->time_start );
}
/**