Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alicealys committed Feb 18, 2022
1 parent fa6df5d commit 5afa80b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/common/utils/http.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 5afa80b

Please sign in to comment.