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

后端 未结 4 745
臣服心动
臣服心动 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 08:00

    Deleted article from CodeProject, this seems to be the copy: DateTimePrecise C# Class The idea is to use QueryPerformanceCounter API for accurate small increments and periodically adjust it in order to keep long term accuracy. This is about to give microsecond accuracy ("about" because it's still not exactly precise, but still quite usable).

    See also: Microsecond resolution timestamps on Windows

提交回复
热议问题