Small fix

This commit is contained in:
Federico Cecchetto 2022-02-18 01:19:40 +01:00
parent fa6df5dcb5
commit 5afa80b085

View File

@ -1,9 +1,14 @@
#include "http.hpp"
#include <algorithm>
#include <curl/curl.h>
#include <gsl/gsl>
#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<int>(std::chrono::duration_cast<
std::chrono::seconds>(now - helper->start).count()));
const auto speed = dlnow / count;
if (*helper->callback)