#include <chrono>
auto start = std::chrono::system_clock::now();
// do something
auto here = std::chrono::system_clock::now();
unsigned int timeUsed = std::chrono::duration_cast<std::chrono::milliseconds>(here - start).count();
#include <Windows.h>
DWORD start_time = 0;
DWORD end_time ;
end_time = GetTickCount(); //从操作系统启动经过的毫秒数
if (end_time - start_time > 1500)
{
double time_ = end_time - start_time;
double time_s = time_ /1000;
start_time = end_time;
}