Search code examples
c#timing

C# sub millisecond timing


Is there anywhere in C# to perform timing operations with sub millisecond accuracy? I'm putting timing code in my software and everything is being returned as 0ms. I would like to know if there is a way of getting even finer granularity.

Addendum: is this the correct code to get sub millisecond timing?

timeSpan.TotalMilliseconds / 10

I'm still getting 0 as the elapsed time


Solution

  • You could always try using QueryPerformanceCounter or the StopWatch class for a managed approach