1. 程式人生 > >Linux下的精確計時函式

Linux下的精確計時函式

std::chrono::high_resolution_clock::time_point tnow = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point tpost = std::chrono::high_resolution_clock::now();
std::cout << "open camera cost time: " << std::chrono::duration_cast<std::chrono::duration<double>>(tpost - tnow).count() * 1000 << " ms" << std::endl;

目前確定的準確的計時函式,mark一下,基本上相機的庫裡面都是用的這個