Simple time profiling - strange times

Posted by Gacek on Stack Overflow See other posts from Stack Overflow or by Gacek
Published on 2010-04-29T20:20:05Z Indexed on 2010/04/29 20:27 UTC
Read the original article Hit count: 323

Filed under:

I'm trying to profile my code to check how long it takes to execute some parts of my code.

I've wrapped my most time-consuming part of the code in something like that:

DateTime start = DateTime.Now;
...
... // Here comes the time-consuming part
... 
Console.WriteLine((DateTime.Now - start).Miliseconds);

The program is executing this part of code for couple of seconds (about 20 s) but in console I get the result of something about 800 miliseconds. Why is that so? What am I doing wrong?

© Stack Overflow or respective owner

Related posts about c#