Several questions about header in C++ 11

前端 未结 2 1829
借酒劲吻你
借酒劲吻你 2021-02-14 14:34

I have several questions about new header in C++ 11. Using Windows 7, Visual Studio 2012.

Looking at the example http://en.cppreference.com/w

2条回答
  •  梦如初夏
    2021-02-14 14:56

    1) I'm fairly certain the highest resolution you can get is to use std::chrono::high_resolution_clock and then don't do any duration casting:

    int elapsed_ticks = (end-start).count();
    

    2) Change the argument of duration_cast to something like nanoseconds:

    int elapsed_seconds = std::chrono::duration_cast
                                 (end-start).count();
    

提交回复
热议问题