Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

new version

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
jd440
Smarty n00b


Joined: 26 Mar 2013
Posts: 4

PostPosted: Tue Sep 23, 2014 5:43 am    Post subject: new version Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Sep 23, 2014 3:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Sep 23, 2014 3:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP