文章目录
#include <chrono>
#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
auto t_a = chrono::high_resolution_clock::now();
sleep(1);
// do something
auto t_b = chrono::high_resolution_clock::now();
cout << chrono::duration_cast<chrono::microseconds>(t_b - t_a).count() << endl;
}