Get an unsigned int milliseconds out of chrono::duration

前端 未结 2 1673
忘掉有多难
忘掉有多难 2021-02-07 11:17

For a winapi wrapper I want to use chrono for a duration given to the call. The code example:

bool setTimer(std::chrono::duration

        
2条回答
  •  借酒劲吻你
    2021-02-07 11:49

    You can use the following code:

    auto now = chrono::high_resolution_clock::now();
    
    auto timeMillis = chrono::duration_cast(now.time_since_epoch()).count();
    

提交回复
热议问题