随笔分类 - c++时间相关
记录获取当前时间,程序执行时间,时间戳标准化等代码
摘要:std::string millisecond_to_str(const std::int64_t &milliseconds) { std::chrono::milliseconds ms(milliseconds); std::chrono::time_point<std::chrono::hi
阅读全文
摘要:使用chrono获取当前系统时间,使用std::put_time 将时间标准化 时间戳格式化为指定的字符串 #include <chrono> #include <iostream> #include <iomanip> #include <ctime> void test_system_clock
阅读全文
摘要:点击查看代码,可修改milli配置输出时间级别,当前毫秒级 auto begin = std::chrono::steady_clock::now(); fun(); auto end = std::chrono::steady_clock::now(); std::cout<<"fun need:
阅读全文
摘要:点击查看代码 long long get_cur_time(){ // 获取操作系统当前时间点(精确到微秒) chrono::time_point<chrono::system_clock, chrono::microseconds> tpMicro = chrono::time_point_cas
阅读全文