Calculating time by the C++ code

后端 未结 7 784
囚心锁ツ
囚心锁ツ 2021-01-02 22:21

I know this question has been asked few times over SO but none of them is really helping me out, so asking again.

I am using windows xp and running visual studio c++

7条回答
  •  走了就别回头了
    2021-01-02 23:04

    Kornel's suggestion of using QueryPerformanceCounter is an excellent one.

    If that doesn't work for you, and you don't mind another Windows-only solution, use the Windows "multimedia timers". Search the Visual Studio help files for "timeBeginPeriod", "timeEndPeriod", and "Using Multimedia Timers".

    To use the multimedia timers, you need to include the header and link with winmm.lib:

    #include 
    #pragma comment( lib, "winmm" )     //  need this library for multimedia timers
    

提交回复
热议问题