C++11 std::chrno简单运用

//该程序意在输出10分之1秒的系统时间戳
void printTimestamp(void)
{
    using namespace std::chrono;

    typedef typename duration<long, std::ratio<1, 10>> mseconds;
    time_point<system_clock, mseconds> tp = time_point_cast<mseconds>(system_clock::now());
    auto tmp = duration_cast<mseconds>(tp.time_since_epoch());
    auto timeStamp = tmp.count();

    printf("Current timeStamp(10 percent of a second)==%lu
", timeStamp);
}
原文地址:https://www.cnblogs.com/pureLaw/p/9252531.html