What I mean is…
get the time, run the code, get the time, compare the time and get the seconds out:
am I doing this right?
DateTime timestamp = DateTime.Now;
//...do the code...
DateTime endstamp = DateTime.Now;
string results = ((endstamp.ticks - timestamp.ticks)/10000000).ToString();
No. Use the
System.Diagnostics.Stopwatchclass instead.DateTime.Nowdoesn’t have the level of precision that you desire (although theDateTimestruct is plenty precise, in and of itself).