码迷,mamicode.com
首页 > 编程语言 > 详细

C++常用库

时间:2021-05-24 06:07:05      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:seconds   second   class   nose   lis   type   int   const   time   

 

 

#include <chrono>
    /// nanoseconds
    typedef duration<_GLIBCXX_CHRONO_INT64_T, nano>         nanoseconds;

    /// microseconds
    typedef duration<_GLIBCXX_CHRONO_INT64_T, micro>         microseconds;

    /// milliseconds
    typedef duration<_GLIBCXX_CHRONO_INT64_T, milli>         milliseconds;

    /// seconds
    typedef duration<_GLIBCXX_CHRONO_INT64_T>             seconds;

    /// minutes
    typedef duration<_GLIBCXX_CHRONO_INT64_T, ratio< 60>>   minutes;

    /// hours
    typedef duration<_GLIBCXX_CHRONO_INT64_T, ratio<3600>>  hours;

计时

const auto tp_1 = std::chrono::steady_clock::now();
matcher->match(desc_1, desc_2, matches);
const auto tp_2 = std::chrono::steady_clock::now();

const auto track_time = std::chrono::duration_cast<std::chrono::milliseconds>(tp_2 - tp_1).count();
td::cout<<"match_time: "<<track_time<<"ms" <<std::endl;

 

C++常用库

标签:seconds   second   class   nose   lis   type   int   const   time   

原文地址:https://www.cnblogs.com/xiaohuidi/p/14757673.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!