• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

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
0
BeginningWebDesign
Asked:
BeginningWebDesign
  • 4
  • 3
1 Solution
 
bigjim2000Commented:
Are you implementing a search function on your own site?

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
0
 
BeginningWebDesignAuthor Commented:
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
0
 
Fahad MukhtarDistinguished EngineerCommented:
DateTime t3,t4;
t3 = DateTime.Now;

System.Threading.Thread.Sleep(400); //repalce your Search code here

t4 = DateTime.Now;
TimeSpan t = t4-t3;
MessageBox.Show(t.Milliseconds.ToString());//on my machine it returned 402
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Fahad MukhtarDistinguished EngineerCommented:
You can get Seconds by dividing s.Milliseconds by 1000 or by directly using t.Seconds
0
 
BeginningWebDesignAuthor Commented:
Hi Desp

Not sure what you mean by the following: //repalce your Search code here
Do I enter the querystring

Caz
0
 
Fahad MukhtarDistinguished EngineerCommented:


DateTime t3,t4;
t3 = DateTime.Now;//get the time before searching

//Put your search code that you do for searching

t4 = DateTime.Now; // get the time after searching completes
TimeSpan t = t4-t3; // get the difference of the two timings

MessageBox.Show(t.Milliseconds.ToString());//on my machine it returned 402
0
 
BeginningWebDesignAuthor Commented:
Thanks Desp

I understand most the code, could you tell me what this section means and does for future referance

System.Threading.Thread.Sleep(400);

Caz
0
 
Fahad MukhtarDistinguished EngineerCommented:
System.Threading.Thread.Sleep(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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now