.NET System.Diagnostics.Stopwatch issue (returns values too low)

前端 未结 7 1119
眼角桃花
眼角桃花 2021-02-13 23:14

On my computer the Stopwatch is returning values way too low. For example, 200 ms when I specified Thread.Sleep(1000). The program is supposed to wait 1 second. I a

7条回答
  •  长情又很酷
    2021-02-14 00:14

    If the Stopwatch doesn't work, you can use the QueryPerformanceCounter on Windows.

    See this little class on http://www.windojitsu.com/code/hirestimer.cs.html

提交回复
热议问题