Script Timer

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

Im new to csharp. I need to time the execute time of a script and
output the time as a string.

can someone help me write this function


time1 //at the beginning of the script

..
..
..

time2 //at the end of the script
string exeTime = time2 - time1


thanks
 
Aaron said:
I need to time the execute time of a script and
output the time as a string.

DateTime dtStart = DateTime.Now;

// Wait three seconds
while ((DateTime.Now - dtStart).Seconds < 3) { }

DateTime dtEnd = DateTime.Now;

Console.WriteLine("Time taken: {0}", dtEnd - dtStart);

P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Script Timer 1
Times out of sequence 4
Sorting 3
Number of hours between 2 dates 2
[C#] Fatal stack overflow 4
Time between time 2
DateDiff Time 3
c# add datagrid column for computed POOM appointment value 4

Back
Top