Is it normal behaviour that Stopwatch can return negative values? Code sample below can be used to reproduce it.
while (true)
{
Stopwatch sw = new Stopwatch();
sw.Start();
sw.Stop();
if (sw.ElapsedMilliseconds < 0)
Debugger.Break();
}
The only place where I can reproduce negative numbers is my virtual machine (hosted by Hyper-V on a 8-core machine)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…