The C `clock()` function just returns a zero

前端 未结 6 784
醉话见心
醉话见心 2020-11-30 07:58

The C clock() function just returns me a zero. I tried using different types, with no improvement... Is this a good way to measure time with good precision?

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 08:33

    clock() reports CPU time used. sleep() doesn't use any CPU time. So your result is probably exactly correct, just not what you want.

提交回复
热议问题