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)