Measuring time with a resolution of microseconds in C++?

后端 未结 6 1439
醉话见心
醉话见心 2020-12-11 22:02

I\'m looking for a way to measure microsecs in C++/Windows.

I read about the \"clock\" function, but it returns only milliseconds...
Is there a way to do it?

6条回答
  •  [愿得一人]
    2020-12-11 22:53

    I guess there's nothing wrong with the QuerPerformance* answer already given: the question was for a Windows-specific solution, and this is it. For a cross-platform C++ solution, I guess boost::chrono makes most sense. The Windows implementation uses the QuerPerformance* methods, and you immediately have a Linux and Mac solution too.

提交回复
热议问题