allow timer_stop() to use number_format() when returning. Props mdawaffe and nbachiyski. fixes #991

git-svn-id: http://svn.automattic.com/wordpress/trunk@4345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2006-10-04 22:00:53 +00:00
parent 1c9f6b4852
commit a9d23d40d5
2 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p> <p><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
<p> <p>
<?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?> <br /> <?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?> <br />
<?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), number_format(timer_stop(), 2)); ?> <?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?>
</p> </p>
</div> </div>
<?php do_action('admin_footer', ''); ?> <?php do_action('admin_footer', ''); ?>

View File

@ -67,9 +67,10 @@ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(
$mtime = $mtime[1] + $mtime[0]; $mtime = $mtime[1] + $mtime[0];
$timeend = $mtime; $timeend = $mtime;
$timetotal = $timeend-$timestart; $timetotal = $timeend-$timestart;
$r = number_format($timetotal, $precision);
if ( $display ) if ( $display )
echo number_format($timetotal,$precision); echo $r;
return $timetotal; return $r;
} }
timer_start(); timer_start();