Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating "Page created in 2.1 secs" script 1

Status
Not open for further replies.

perlone

Programmer
May 20, 2001
438
US
Hello,

I have seen on some pages that has "Page created in 1.2 seconds" and I was wondering if anyone could show me how that is done or give me some idea. Thank you so much for reading.
 
Code:
$start=time;
# Do funky stuff
$finish=time;
$timetaken = $finsh-$start;
(@date)=localtime($timetaken);
$time_taken = sprintf("0.2d",$date[2]).":".sprintf("0.2d",$date[1]).":".sprintf("%0.2d", $date[0]);
Will give you the HH:MM:SS, but for more grnaular timings I'd look at some of the benchmarking modules on CPAN

HTH
Paul



It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Thank You

There is no Knowledge that is not power.
Age: 17
E-mail: projectnet01@yahoo.com
Company:(not done yet) :)
Status: Currently working with C++ for game developing. And making a musical band.
-Aaron
 
hi,

for some reason it displays like this:

0.2d:0.2d:44

how can i fix this? Thanks
 
Apologies typo

sprintf("%0.2d", Sdate[x]);

Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Using the benchmark.pm module you can also get cpu clock cycles and really see how fast things are.


haunter@battlestrata.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top