From c5da853dc93e8dc1cb6d3adb67ec1f189e0f22d9 Mon Sep 17 00:00:00 2001 From: dr|z3d Date: Thu, 12 Aug 2021 04:23:05 +0000 Subject: [PATCH] Console: ensure all latency readouts display in seconds when required --- daemon/HTTPServer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index dc700016..687e333a 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -938,10 +938,17 @@ namespace http { << "[" << tr("Out") << "] " << ""; it->Print(s); - if(it->LatencyIsKnown()) - s << " " << it->GetMeanLatency() << tr("ms") << ""; - else // placeholder for alignment + if(it->LatencyIsKnown()) { + s << " "; + if (it->GetMeanLatency() >= 1000) { + s << std::fixed << std::setprecision(2); + s << (double) it->GetMeanLatency() / 1000 << tr(/* tr: seconds */ "s") << ""; + } else { + s << it->GetMeanLatency() << tr(/* tr: Milliseconds */ "ms") << ""; + } + } else { // placeholder for alignment s << " --- "; + } ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumSentBytes ()); s << "\r\n\r\n"; }