|
@@ -7,9 +7,12 @@ std::string getTimeString()
|
|
|
{
|
|
|
auto now = std::chrono::system_clock::now();
|
|
|
auto t = std::chrono::system_clock::to_time_t(now);
|
|
|
+ auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
|
|
|
+
|
|
|
std::tm tm = *std::localtime(&t);
|
|
|
-
|
|
|
+
|
|
|
std::ostringstream oss;
|
|
|
- oss << std::put_time(&tm, "%Y_%m_%d_%H_%M_%S_%z");
|
|
|
+ oss << std::put_time(&tm, "%Y_%m_%d_%H_%M_%S")
|
|
|
+ << "_" << std::setfill('0') << std::setw(3) << ms.count(); // 添加毫秒部分
|
|
|
return oss.str();
|
|
|
}
|