Search time script

liunx

Guest
Hey all. I was wondering if anyone has made a "time searched in" script, like what you see on any of the major search engines. I wanted to use something like it in one of my pages for work.

i.e.

(Google) Results 1 - 10 of about 2,340,000 for bla [definition] (0.03 seconds) << this part
Thanks for any help!

_strykerdim x
x=timer

....code for search

Response.write("Time elapsed:" & (timer-x))


timer is ASP's "stopwatch" function. You'll have to fomat it up a bit because I think it works in milliseconds or something to that effect.

Here's the function (with example) that I use....

dim x
x=timer

....code....
response.Write(fmtSec(timer,x))

function fmtSec(y, x)
fmtSec = formatnumber(y - x, 3) & " seconds"
end function


Timer's very handy, also, if you have a page that seems to be taking too long but you're not sure which part of the page is causing the slow down, you could do something like.....

dim x
x=timer
.....code part 1.....
response.Write(fmtSec(timer,x) & " after part 1<BR>")
.....code part 2.....
response.Write(fmtSec(timer,x) & " after part 2<BR>")
.....code part 3.....
response.Write(fmtSec(timer,x) & " after part 3<BR>")


....then by doing some simple math you can easily figure out which part of the 3 is killing ya.Works perfectly, thanks a lot Putts.
 
Back
Top