[PHP] time() TIMER in seconds or just numbers
what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? how do you determine the next 5 mins? -- Best Wishes willandy.co.uk
Re: [PHP] time() TIMER in seconds or just numbers
2009/3/30 Andrew Williams andrew4willi...@gmail.com: what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? The number of seconds it took to do something. how do you determine the next 5 mins? Assuming you mean what will time() return in 5 minutes time?... $five_minutes_time = time() + 300; // 300 seconds in 5 minutes If you mean something else please try rephrasing the question. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
2009/3/30 Andrew Williams andrew4willi...@gmail.com: what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? $end_time is not a great name for it: it's the time (number of seconds) it took to go from $t1 to $t2. $duration might be better. how do you determine the next 5 mins? Eh? time() + 300 is five minutes from now. -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated March 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
When someone does that, it means the execution time between $t1 and $t2... Att, Igor Escobar systems analyst interface designer www . igorescobar . com On Mon, Mar 30, 2009 at 7:38 AM, Richard Heyes rich...@php.net wrote: 2009/3/30 Andrew Williams andrew4willi...@gmail.com: what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? $end_time is not a great name for it: it's the time (number of seconds) it took to go from $t1 to $t2. $duration might be better. how do you determine the next 5 mins? Eh? time() + 300 is five minutes from now. -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated March 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated March 14th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes rich...@php.net wrote: When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 12:05 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes rich...@php.net wrote: When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I have a couple of managers you can have...they bleat like sheep most of the time any way and don't provide much other than dung... -- Bastien Cat, the other other white meat
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar titiolin...@gmail.com wrote: The people use that to measure performance. If you're intersted about that read http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ (in portuguese, sorry) Regards, Igor Escobar On Mon, Mar 30, 2009 at 1:05 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes rich...@php.net wrote: When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... Oh, I'm fully aware of what it's for. FYI, microtime() is probably more appropriate, since 1 full second in computer terms is a loong time. ...and I don't speak a lick of Portuguese. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
Okey, but you understand the purpouse of it? Igor Escobar systems analyst interface designer www . igorescobar . com On Mon, Mar 30, 2009 at 3:42 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar titiolin...@gmail.com wrote: The people use that to measure performance. If you're intersted about that read http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ (in portuguese, sorry) Regards, Igor Escobar On Mon, Mar 30, 2009 at 1:05 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes rich...@php.net wrote: When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... Oh, I'm fully aware of what it's for. FYI, microtime() is probably more appropriate, since 1 full second in computer terms is a loong time. ...and I don't speak a lick of Portuguese. -- // Todd
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 1:51 PM, Igor Escobar titiolin...@gmail.com wrote: Okey, but you understand the purpouse of it? On Mon, Mar 30, 2009 at 3:42 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 11:37 AM, Igor Escobar titiolin...@gmail.com wrote: The people use that to measure performance. If you're intersted about that read http://www.igorescobar.com/blog/2009/03/05/benchmarking-de-desempenho-no-php/ (in portuguese, sorry) Regards, Igor Escobar On Mon, Mar 30, 2009 at 1:05 PM, haliphax halip...@gmail.com wrote: On Mon, Mar 30, 2009 at 10:47 AM, Richard Heyes rich...@php.net wrote: When someone does that, it means the execution time between $t1 and $t2... Is that for my benefit? Believe it or not, I do know the arcane art of subtraction... I would subtract more often, but sacrificial farm animals and black candles are so hard to come by these days... Oh, I'm fully aware of what it's for. FYI, microtime() is probably more appropriate, since 1 full second in computer terms is a loong time. ...and I don't speak a lick of Portuguese. Please stop top-posting. I'm fully aware of what it's for == I am aware of its purpose. My point was that time() gives you seconds since the UNIX epoch, whereas microtime(true) will give you more accurate results if you are looking to benchmark a script. If your script takes a few minutes and you don't really care about measuring those milli/micro seconds, then time() should suit your needs just fine. However, if your script can perform an iteration in less than one second, you have already eliminated the usefulness of time() for benchmarks. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
Andrew Williams wrote: what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? how do you determine the next 5 mins? So if you haven't deduced the answer from other replies, this would probably be more readable: $start_time = time(); //or microtime() //do something $end_time = time(); //or microtime() $duration = $end_time - $start_time; echo $duration; -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] time() TIMER in seconds or just numbers
On Mon, Mar 30, 2009 at 3:35 PM, Shawn McKenzie nos...@mckenzies.net wrote: Andrew Williams wrote: what does time(); $t1 = time(); { do something } $t2 = time(); $end_time = $t2 - $t1; echo $end_time; what does $end_time represent? how do you determine the next 5 mins? So if you haven't deduced the answer from other replies, this would probably be more readable: $start_time = time(); //or microtime() //do something $end_time = time(); //or microtime() $duration = $end_time - $start_time; echo $duration; Don't forget--microtime() without the boolean true as an argument will split the result into two parts. Using true as the argument (minus quotes, of course) gives you a floating-point representation of seconds/milliseconds/etc. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php