As per MSDN:
The Stopwatch measures elapsed time by counting timer ticks in the underlying timer mechanism. If the installed hardware and operating system support a high-resolution performance counter, then the Stopwatch class uses that counter to measure elapsed time. Otherwise, the Stopwatch class uses the system timer to measure elapsed time. Use the Frequency and IsHighResolution fields to determine the precision and resolution of the Stopwatch timing implementation.
It uses a higher resolution / precision than DateTime.Now
.
You can also check out these related links:
Environment.TickCount vs DateTime.Now
Is DateTime.Now the best way to measure a function's performance?
DateTime
is good enough for precision to the second probably but anything beyond that I would recommend StopWatch
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…