#include <chrono>
//기존에 GetTickCount, QueryPerformanceCounter, QueryPerformanceFrequency 등을 이용했었는데 완전 편해졌다.
void test_chrono()
{
std::chrono::system_clock::time_point start_time = std::chrono::system_clock::now();
Sleep(2000);
std::chrono::system_clock::time_point end_time = std::chrono::system_clock::now();
// 나노 초 단위 (1/1000000000)
std::chrono::nanoseconds nano = std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time);
//마이크로 초 단위 (1/1000000)
std::chrono::microseconds micro = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
//밀리 초 단위 (1/1000)
std::chrono::milliseconds mill = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
std::chrono::seconds sec = std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time);
std::chrono::minutes min = std::chrono::duration_cast<std::chrono::minutes>(end_time - start_time);
std::chrono::hours hour = std::chrono::duration_cast<std::chrono::hours>(end_time - start_time);
std::cout << "sleep time: " << nano.count() << " nanoseconds" << std::endl;
std::cout << "sleep time: " << micro.count() << " microseconds" << std::endl;
std::cout << "sleep time: " << mill.count() << " milliseconds" << std::endl;
std::cout << "sleep time: " << sec.count() << " seconds" << std::endl;
std::cout << "sleep time: " << min.count() << " minutes" << std::endl;
std::cout << "sleep time: " << hour.count() << " hour" << std::endl;
}