On my computer the Stopwatch is returning values way too low. For example, 200 ms when I specified Thread.Sleep(1000)
. The program is supposed to wait 1 second. I a
Seems like you're using Tick count in some cases. Remember that by default on modern Windows for example, the OS will save CPU. This means that the tick count and the time elapsed are not in linear proportion.
I suggest you try using the Stopwatch.ElapsedMilliseconds
in the most basic form:
var sw = new Stopwatch();
sw.Start();
Thread.Sleep(1000);
var elpased = sw.Elapsed;