博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
chrono
阅读量:7009 次
发布时间:2019-06-28

本文共 955 字,大约阅读时间需要 3 分钟。

 

 

  •  将毫秒转换为时分秒毫秒表示
using namespace std;using namespace std::chrono;milliseconds ms(7255042);// split into hours, minutes, seconds, and millisecondshours   hh         = duration_cast
(ms);minutes mm   = duration_cast
(ms % chrono::hours(1));seconds ss = duration_cast
(ms % chrono::minutes(1));milliseconds msec = duration_cast
(ms % chrono::seconds(1));// and print durations and values:cout << "raw: " << hh << "::" << mm << "::" << ss << "::" << msec << endl;cout << " " << setfill(’0’) << setw(2) << hh.count() << "::" << setw(2) << mm.count() << "::" << setw(2) << ss.count() << "::" << setw(3) << msec.count() << endl;
raw: [2 of 3600/1]::[0 of 60/1]::[55 of 1/1]::[42 of 1/1000] 02::00::55::042

 

转载于:https://www.cnblogs.com/Searchor/p/5609353.html

你可能感兴趣的文章