C# Stopwatch shows incorrect time

后端 未结 1 454
死守一世寂寞
死守一世寂寞 2021-01-01 22:19

I have seen other user posts which show Stopwatch measuring time spent in \"Thread.Sleep(5000)\" to be around 5000ms.

But my program produces the following results

1条回答
  •  庸人自扰
    2021-01-01 22:45

    The Stopwatch class is not reliable.

    This is unreliable on processors that do not have a constant clock speed (most processors can reduce the clock speed to conserve energy). This is explained in detail here.

    0 讨论(0)
提交回复
热议问题