Inline documentation fixes for timer_stop().

See #26874.


git-svn-id: https://develop.svn.wordpress.org/trunk@27335 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2014-03-01 02:41:45 +00:00
parent 54a8eff27a
commit 1276f69288

View File

@ -196,30 +196,21 @@ function timer_start() {
} }
/** /**
* Return and/or display the time from the page start to when function is called. * Retrieve or display the time from the page start to when function is called.
*
* You can get the results and print them by doing:
* <code>
* $nTimePageTookToExecute = timer_stop();
* echo $nTimePageTookToExecute;
* </code>
*
* Or instead, you can do:
* <code>
* timer_stop(1);
* </code>
* which will do what the above does. If you need the result, you can assign it to a variable, but
* in most cases, you only need to echo it.
* *
* @since 0.71 * @since 0.71
* @global float $timestart Seconds from when timer_start() is called
* @global float $timeend Seconds from when function is called
* *
* @param int $display Use '0' or null to not echo anything and 1 to echo the total time * @global float $timestart Seconds from when timer_start() is called.
* @param int $precision The amount of digits from the right of the decimal to display. Default is 3. * @global float $timeend Seconds from when function is called.
* @return string The "second.microsecond" finished time calculation. The number is formatted for human consumption, it is both localized and rounded. *
* @param int $display Whether to echo or return the results. Accepts 0|false for return,
* 1|true for echo. Default 0|false.
* @param int $precision The number of digits from the right of the decimal to display.
* Default 3.
* @return string The "second.microsecond" finished time calculation. The number is formatted
* for human consumption, both localized and rounded.
*/ */
function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal function timer_stop( $display = 0, $precision = 3 ) {
global $timestart, $timeend; global $timestart, $timeend;
$timeend = microtime( true ); $timeend = microtime( true );
$timetotal = $timeend - $timestart; $timetotal = $timeend - $timestart;