WordPress at a glance

timer_stop() WP 1.0

Retrieve or display the time from the page start to when function is called.

Notes:

  • Global. float. $timestart Seconds from when timer_start() is called.
  • Global. float. $timeend Seconds from when function is called.

No Hooks.

Return

String. The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.

Usage

timer_stop( $display, $precision );
$display(int/true/false)
Whether to echo or return the results. Accepts 0|false for return, 1|true for echo.
Default: 0|false
$precision(int)
The number of digits from the right of the decimal to display.
Default: 3

Code of timer_stop: wp-includes/load.php VER 4.9.8

<?php
function timer_stop( $display = 0, $precision = 3 ) {
	global $timestart, $timeend;
	$timeend = microtime( true );
	$timetotal = $timeend - $timestart;
	$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
	if ( $display )
		echo $r;
	return $r;
}

Related Functions

From tag: debug

More from category: Helper Functions

No comments
    Hello, !     Log In . Register