From afab06cc73b622d7a6eb05f7ba01b62e1574e2fc Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 3 Feb 2012 08:32:34 +0000 Subject: [PATCH] wfTime() -> microtime( true ), no need to use the former which is just a wrapper to the latter --- includes/GlobalFunctions.php | 6 ++---- includes/Wiki.php | 4 ++-- includes/WikiPage.php | 4 ++-- includes/debug/Debug.php | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 29d4644841..a2fa48add1 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1056,8 +1056,7 @@ function wfLogProfilingData() { // Get total page request time and only show pages that longer than // $wgProfileLimit time (default is 0) - $now = wfTime(); - $elapsed = $now - $wgRequestTime; + $elapsed = microtime( true ) - $wgRequestTime; if ( $elapsed <= $wgProfileLimit ) { return; } @@ -1560,8 +1559,7 @@ function wfHostname() { function wfReportTime() { global $wgRequestTime, $wgShowHostnames; - $now = wfTime(); - $elapsed = $now - $wgRequestTime; + $elapsed = microtime( true ) - $wgRequestTime; return $wgShowHostnames ? sprintf( '', wfHostname(), $elapsed ) diff --git a/includes/Wiki.php b/includes/Wiki.php index 91541551db..86883d9751 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -431,9 +431,9 @@ class MediaWiki { while ( $n-- && false != ( $job = Job::pop() ) ) { $output = $job->toString() . "\n"; - $t = -wfTime(); + $t = - microtime( true ); $success = $job->run(); - $t += wfTime(); + $t += microtime( true ); $t = round( $t * 1000 ); if ( !$success ) { $output .= "Error: " . $job->getLastError() . ", Time: $t ms\n"; diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 68fd05cd6f..5966299a09 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2861,10 +2861,10 @@ class PoolWorkArticleView extends PoolCounterWork { $text = $rev->getText(); } - $time = - wfTime(); + $time = - microtime( true ); $this->parserOutput = $wgParser->parse( $text, $this->page->getTitle(), $this->parserOptions, true, true, $this->revid ); - $time += wfTime(); + $time += microtime( true ); # Timing hack if ( $time > 3 ) { diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index 616eb56cb1..2f03feec9c 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -200,7 +200,7 @@ class MWDebug { 'function' => $function, 'master' => (bool) $isMaster, 'time' > 0.0, - '_start' => wfTime(), + '_start' => microtime( true ), ); return count( self::$query ) - 1; @@ -216,7 +216,7 @@ class MWDebug { return; } - self::$query[$id]['time'] = wfTime() - self::$query[$id]['_start']; + self::$query[$id]['time'] = microtime( true ) - self::$query[$id]['_start']; unset( self::$query[$id]['_start'] ); } @@ -257,7 +257,7 @@ class MWDebug { $debugInfo = array( 'mwVersion' => $wgVersion, 'phpVersion' => PHP_VERSION, - 'time' => wfTime() - $wgRequestTime, + 'time' => microtime( true ) - $wgRequestTime, 'log' => self::$log, 'debugLog' => self::$debug, 'queries' => self::$query, -- 2.20.1