c++编写计时函数

2021/6/15 1:20:55

本文主要是介绍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;


这篇关于c++编写计时函数的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程