std::string millisecond_to_str(const std::int64_t &milliseconds)
{
std::chrono::milliseconds ms(milliseconds);
std::chrono::time_point<std::chrono::high_resolution_clock, std::chrono::milliseconds> t1(ms);
std::time_t t = std::chrono::system_clock::to_time_t(t1);
std::stringstream ss;
auto const msecs = ms.count() % 1000;
ss << std::put_time(std::localtime(&t), "%Y-%m-%d %H.%M.%S") << "." << msecs;
return ss.str();
}
标签:std,格式化,chrono,生成,毫秒,ms,time,const,milliseconds From: https://www.cnblogs.com/52ld/p/17563086.html