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

后端 未结 6 1467
醉话见心
醉话见心 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:32

    http://www.boost.org/doc/libs/1_45_0/doc/html/date_time/posix_time.html

    altough

    Get the UTC time using a sub second resolution clock. On Unix systems this is implemented using GetTimeOfDay. On most Win32 platforms it is implemented using ftime. Win32 systems often do not achieve microsecond resolution via this API. If higher resolution is critical to your application test your platform to see the achieved resolution.

提交回复
热议问题