c++编写计时函数

    auto now = std::chrono::steady_clock::now();
    std::chrono::duration<double> diff = std::chrono::steady_clock::now() - now;
    std::cout << "now: " << diff.count() << std::endl;
    std::this_thread::sleep_for(std::chrono::duration<int>(5));
    diff = std::chrono::steady_clock::now() - now;
    std::cout << "sleep_for: " << diff.count() << std::endl;
上一篇:为图像添加时间戳(获取系统时间,精确到毫秒)


下一篇:Linux下C++跨平台获取高精度时间戳