Small fix

This commit is contained in:
Federico Cecchetto 2022-02-18 01:19:22 +01:00
parent 886bd3f714
commit c7246bbd4b

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)