Are StopWatch.ElapsedTicks and StopWatch.Elapsed.Ticks always the same?

后端 未结 2 609
我在风中等你
我在风中等你 2021-01-01 09:57

What does ElapsedTicks and Elapsed.Ticks in the StopWatch class mean? When could the meaning be different than intended?

2条回答
  •  悲&欢浪女
    2021-01-01 10:42

    Elapsed.Ticks / TimeSpan.TicksPerSecond == ElapsedTicks / Stopwatch.Frequency
    

    Of course this may not exactly equal due to rounding, as Stopwatch ticks and TimeSpan ticks are measured in different units. Also, in case you executed the above code literally, obviously some ticks would elapse between taking the value of Elapsed.Ticks and that of ElapsedTicks.

提交回复
热议问题