将time_point转换为float

时间:2017-05-13 18:34:35

标签: c++

我是这个

std::chrono::high_resolution_clock::time_point mElapsedTime;

我想将此time_point和另一个time_point之间的差异转换为浮点数,这可能吗?

1 个答案:

答案 0 :(得分:2)

您可以使用duration cast

std::chrono::duration<float, std::milli> diff = mElapsedTime - mStartedTime;
//access the float with .count
std::cout<<diff.count()<<'\n';