How to realise long-term high-resolution timing on windows using C++?

后端 未结 4 747
臣服心动
臣服心动 2020-12-18 07:19

I need to get exact timestamps every couple of ms (20, 30, 40ms) over a long period of time (a couple of hours). The function in which the timestamp is taken is invoked as a

4条回答
  •  情歌与酒
    2020-12-18 07:48

    There is no such QueryPerformanceTimer() on windows. The resource is named QueryPerformanceCounter(). It provides a counter value counting at some higher frequency. Its incrementing frequency can be retrieved by a call to QueryPerformanceFrequency(). Since this frequency is typically in the MHz range, microsecond resolution can be observed.

    There are some implementations around, i.e. this thread or at the Windows Timestamp Project

提交回复
热议问题