BeginningWebDesign
asked on
Display time for results
Dear EE Community
When you do a search on the EE site it display the time for how long it took to find the records. Does anyone know how to do this.
I use a form that uses the get method and post to another page.
Thank You
Caz
When you do a search on the EE site it display the time for how long it took to find the records. Does anyone know how to do this.
I use a form that uses the get method and post to another page.
Thank You
Caz
ASKER
Hi Eric
Could you put the start time in the page_init() and the end time in the page_unload() and take the end time away from the start time.
If so do you know the syntax for displaying the time accurate to for example: 00.01 second
Caz
Could you put the start time in the page_init() and the end time in the page_unload() and take the end time away from the start time.
If so do you know the syntax for displaying the time accurate to for example: 00.01 second
Caz
DateTime t3,t4;
t3 = DateTime.Now;
System.Threading.Thread.Sl eep(400); //repalce your Search code here
t4 = DateTime.Now;
TimeSpan t = t4-t3;
MessageBox.Show(t.Millisec onds.ToStr ing());//o n my machine it returned 402
t3 = DateTime.Now;
System.Threading.Thread.Sl
t4 = DateTime.Now;
TimeSpan t = t4-t3;
MessageBox.Show(t.Millisec
You can get Seconds by dividing s.Milliseconds by 1000 or by directly using t.Seconds
ASKER
Hi Desp
Not sure what you mean by the following: //repalce your Search code here
Do I enter the querystring
Caz
Not sure what you mean by the following: //repalce your Search code here
Do I enter the querystring
Caz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Desp
I understand most the code, could you tell me what this section means and does for future referance
System.Threading.Thread.Sl eep(400);
Caz
I understand most the code, could you tell me what this section means and does for future referance
System.Threading.Thread.Sl
Caz
System.Threading.Thread.Sl eep(400)
Sleep the current thread for 400 ms.. in other words wait for 400 milliseconds...
thats why my machine returned me 402 milliseconds ~.4 seconds
Sleep the current thread for 400 ms.. in other words wait for 400 milliseconds...
thats why my machine returned me 402 milliseconds ~.4 seconds
If so, just record the time when it starts, record it when you are done, then put the difference in a hiddien field on the posting page. Then when you post to the new page, the time will be there for you to do with what you please :-)
-Eric