Boost:Timer
Example
boost::timer 객체를 사용하여 경과된 시간을 측정하는 방법은 아래와 같다.
다음은 "boost::timer 객체를 사용하여, 경과된 시간을 측정(밀리세컨드)을 하는 방법"에 대해서 설명하고 있습니다.
#include "boost/timer.hpp"
#include <iostream>
#include <windows.h>
int main(int argc, char **argv)
{
boost::timer t;
Sleep(300);
std::cout << "after 300 ms : " << t.elapsed() << std::endl; // 경과된 시간 조회.
Sleep(400);
std::cout << "after 400 ms : " << t.elapsed() << std::endl; // 누적된 경과 시간.
std::cout << "restart timer .." << std::endl;
t.restart(); // 경과된 시간 초기화.
Sleep(500);
std::cout << "after 500 ms : " << t.elapsed() << std::endl; // 경과된 시간 조회.
return 0;
}