编程语言
首页 > 编程语言> > c++编写计时函数

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;

标签:std,chrono,clock,steady,c++,计时,编写,now,diff
来源: https://blog.csdn.net/kiltto/article/details/113700139