Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script Timer

0 views
Skip to first unread message

Aaron

unread,
Dec 25, 2003, 10:25:38 PM12/25/03
to
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

Paul E Collins

unread,
Dec 26, 2003, 5:52:25 AM12/26/03
to
"Aaron" <kuy...@yahoo.com> wrote:

> 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.

--
www.CL4.org


0 new messages