Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display time for results

Posted on 2004-08-17
8
Medium Priority
?
236 Views
Last Modified: 2010-04-15
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
Comment
Question by:BeginningWebDesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 3

Expert Comment

by:bigjim2000
ID: 11818351
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
 

Author Comment

by:BeginningWebDesign
ID: 11818524
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
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 11818570
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 11818583
You can get Seconds by dividing s.Milliseconds by 1000 or by directly using t.Seconds
0
 

Author Comment

by:BeginningWebDesign
ID: 11818647
Hi Desp

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

Caz
0
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 2000 total points
ID: 11818708


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
 

Author Comment

by:BeginningWebDesign
ID: 11819108
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
 
LVL 19

Expert Comment

by:Fahad Mukhtar
ID: 11819291
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question