可能重复,但是什么是 gettimeofday()
在 c++11 中的等价物?
我正在尝试获取微秒级的 64 位时间戳
,类似于 Java/Python。
最佳答案
使用std::chrono::system_clock::now()
.
更新
您可以通过此静态断言检查必要的最小精度:
static_assert (std::ratio_less_equal<std::chrono::system_clock::duration::period,
std::ratio<1,100> >::value, "");
关于c++ - c++11 中的 gettimeofday() 等价物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33609401/