|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jd440 Smarty n00b
Joined: 26 Mar 2013 Posts: 4
|
Posted: Tue Sep 23, 2014 5:43 am Post subject: new version |
|
|
thanks.
no value to start.
I tried also
Code: | {assign var="start_time" value=$smarty.now}
[...]
{assign var="stop_time" value=$smarty.now}
{math assign="duration" equation="x-y" x=$stop_time y=$start_time format="%.9f"}
<hr>
{$duration}
<hr> |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Sep 23, 2014 3:57 pm Post subject: |
|
|
Please note that $smarty.now does return a timestamp in full seconds.
As I assume the processing time will be below a second, so that you got always a doration of 0.
You should use the PHP function microtime() the obtain a timestamp to be able to compute elapsed time below a second.
Code: | {assign var="start_time" value=microtime(true)}
[...]
{assign var="stop_time" value=microtime(true)}
{math assign="duration" equation="x-y" x=$stop_time y=$start_time format="%.9f"}
<hr>
{$duration}
<hr> |
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Sep 23, 2014 3:58 pm Post subject: |
|
|
Please note that $smarty.now does return a timestamp in full seconds.
As I assume the processing time will be below a second, so that you got always a doration of 0.
You should use the PHP function microtime() the obtain a timestamp to be able to compute elapsed time below a second.
Code: | {assign var="start_time" value=microtime(true)}
[...]
{assign var="stop_time" value=microtime(true)}
{math assign="duration" equation="x-y" x=$stop_time y=$start_time format="%.9f"}
<hr>
{$duration}
<hr> |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|