Suppression of negative Elapsed in Stopwatch, this is the comment from the Reference Source:
// When measuring small time periods the StopWatch.Elapsed*
// properties can return negative values. This is due to
// bugs in the basic input/output system (BIOS) or the hardware
// abstraction layer (HAL) on machines with variable-speed CPUs
// (e.g. Intel SpeedStep).
if (!is_running)
return;
elapsed += GetTimestamp () - started;
+ if (elapsed < 0)
+ elapsed = 0;
is_running = false;
}
-#if NET_4_0
public void Restart ()
{
started = GetTimestamp ();
elapsed = 0;
is_running = true;
}
-#endif
}
}