From 4694411d1515adce739ea8ffb46327449d4c4acd Mon Sep 17 00:00:00 2001 From: Ironhammer Std <2482911962@qq.com> Date: Mon, 18 May 2026 11:06:59 +0800 Subject: [PATCH] Add log timestamp in millis --- Log.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Log.cpp b/Log.cpp index 6e68e16..1758685 100644 --- a/Log.cpp +++ b/Log.cpp @@ -1,9 +1,10 @@ -#include "Log.h" +#include "Log.h" #include #include #include #include +#include FileHandle Log::File; @@ -33,7 +34,10 @@ void Log::WriteTimestamp() noexcept tm t; localtime_s(&t, &raw); - fprintf(File, "[%02d:%02d:%02d] ", t.tm_hour, t.tm_min, t.tm_sec); + auto now = std::chrono::system_clock::now(); + auto millis = std::chrono::duration_cast(now.time_since_epoch()) % 1000; + int imilli = (int)millis.count(); + fprintf(File, "[%02d:%02d:%02d:%03d] ", t.tm_hour, t.tm_min, t.tm_sec, imilli); } }