p2p: Make timeout mockable and type safe, speed up test

This commit is contained in:
MarcoFalke
2020-07-10 18:19:11 +02:00
parent fa6d5a238d
commit fadc0c80ae
12 changed files with 62 additions and 54 deletions

View File

@@ -20,6 +20,7 @@
#include <script/script.h>
#include <script/standard.h>
#include <util/system.h>
#include <util/time.h>
#ifdef WIN32
#ifndef NOMINMAX
@@ -705,8 +706,9 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
assert(false);
}
QString formatDurationStr(int secs)
QString formatDurationStr(std::chrono::seconds dur)
{
const auto secs = count_seconds(dur);
QStringList strList;
int days = secs / 86400;
int hours = (secs % 86400) / 3600;