From c7246bbd4b0f99526ff81f1281706bf908866a57 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Fri, 18 Feb 2022 01:19:22 +0100 Subject: [PATCH] Small fix --- src/common/utils/http.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/utils/http.cpp b/src/common/utils/http.cpp index fca7d8f3..a558b13a 100644 --- a/src/common/utils/http.cpp +++ b/src/common/utils/http.cpp @@ -1,9 +1,14 @@ #include "http.hpp" +#include #include #include #pragma comment(lib, "ws2_32.lib") +#ifdef max +#undef max +#endif + namespace utils::http { namespace @@ -22,8 +27,8 @@ namespace utils::http try { const auto now = std::chrono::high_resolution_clock::now(); - const auto count = std::chrono::duration_cast< - std::chrono::milliseconds>(now - helper->start).count(); + const auto count = std::max(1, static_cast(std::chrono::duration_cast< + std::chrono::seconds>(now - helper->start).count())); const auto speed = dlnow / count; if (*helper->callback)