diff --git a/src/Logger.cpp b/src/Logger.cpp index e2be104..48fd90e 100644 --- a/src/Logger.cpp +++ b/src/Logger.cpp @@ -92,7 +92,8 @@ extern void L_LOG(const char* fileName, int line, const char* funName, L_LEVEL l extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput) { static std::chrono::steady_clock::time_point lastlogtime; - static double lastPercentage = 0.0f; + static int64_t lastDone = -1; + static int64_t lastTotal = -1; if (!logEnabled) { return; @@ -106,15 +107,16 @@ extern void LOG_PROGRESS(int64_t done, int64_t total, bool forceOutput) return; } + if (done == lastDone && total == lastTotal) + return; + lastDone = done; + lastTotal = total; + double percentage = 0; if (total > 0) { percentage = static_cast(done) / static_cast(total); } - if (percentage == lastPercentage) - return; - lastPercentage = percentage; - // In case the toal/done are incorrect, put 50% if (percentage < 0 || percentage > 1) { percentage = 0.5;