Welcome Guest, Not a member yet? Register   Sign In
{elapsed_time} in ms
#1

[eluser]Cro_Crx[/eluser]
Hey all

I'm in the process of making my first CI super duper awesome website and I've got a simple question.

I was using {elapsed_time} on one of my pages, but I want to display the time in ms and not seconds. As the string is replaced afterward I'm starting to think it's not possible.

Here's what i've tried soo far
Code:
$time = '{elapsed_time}';
echo $time;

// outputs something like 0.05540

Code:
$time = '{elapsed_time}';
echo $time * 1000;

// Outputs "0"

I tried using printf as well with no luck like this

Code:
$time = '{elapsed_time}';
printf("%f", $time);

// Outputs "0.000000"

I tried all of the above with $this->benchmark->elapsed_time() in place of {elapsed_time} with no luck.

Any ideas ?
#2

[eluser]Cro_Crx[/eluser]
Not a big issue, I'll just live with the time in seconds!
#3

[eluser]Derek Jones[/eluser]
You could extend the Benchmark class and change the output of elapsed_time()




Theme © iAndrew 2016 - Forum software by © MyBB