aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h2
-rw-r--r--src/qt/guiutil.cpp5
-rw-r--r--src/qt/guiutil.h3
-rw-r--r--src/qt/rpcconsole.cpp2
-rw-r--r--src/rpc/net.cpp4
6 files changed, 13 insertions, 5 deletions
diff --git a/src/net.cpp b/src/net.cpp
index cb4067e825..a1d1bf5cbf 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -555,7 +555,7 @@ void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap)
}
// Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :)
- stats.dPingTime = (((double)nPingUsecTime) / 1e6);
+ stats.m_ping_usec = nPingUsecTime;
stats.dMinPing = (((double)nMinPingUsecTime) / 1e6);
stats.dPingWait = (((double)nPingUsecWait) / 1e6);
diff --git a/src/net.h b/src/net.h
index 7d3eaa2e0d..17d1d67dea 100644
--- a/src/net.h
+++ b/src/net.h
@@ -596,7 +596,7 @@ public:
mapMsgCmdSize mapRecvBytesPerMsgCmd;
NetPermissionFlags m_permissionFlags;
bool m_legacyWhitelisted;
- double dPingTime;
+ int64_t m_ping_usec;
double dPingWait;
double dMinPing;
CAmount minFeeFilter;
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 911322092c..88dc87a7fc 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -778,6 +778,11 @@ QString formatPingTime(double dPingTime)
return (dPingTime == std::numeric_limits<int64_t>::max()/1e6 || dPingTime == 0) ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10));
}
+QString formatPingTime(int64_t ping_usec)
+{
+ return (ping_usec == std::numeric_limits<int64_t>::max() || ping_usec == 0) ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(ping_usec / 1000), 10));
+}
+
QString formatTimeOffset(int64_t nTimeOffset)
{
return QString(QObject::tr("%1 s")).arg(QString::number((int)nTimeOffset, 10));
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 05e73cc5f0..913d38c48a 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -205,6 +205,9 @@ namespace GUIUtil
/* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/
QString formatPingTime(double dPingTime);
+ /* Format a CNodeStats.m_ping_usec into a user-readable string or display N/A, if 0*/
+ QString formatPingTime(int64_t ping_usec);
+
/* Format a CNodeCombinedStats.nTimeOffset into a user-readable string. */
QString formatTimeOffset(int64_t nTimeOffset);
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index e1f783b0e5..152d3a415f 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -1109,7 +1109,7 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
ui->peerBytesSent->setText(GUIUtil::formatBytes(stats->nodeStats.nSendBytes));
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nTimeConnected));
- ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime));
+ ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_ping_usec));
ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingWait));
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.dMinPing));
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 92542539df..628e85ce01 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -165,8 +165,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
obj.pushKV("bytesrecv", stats.nRecvBytes);
obj.pushKV("conntime", stats.nTimeConnected);
obj.pushKV("timeoffset", stats.nTimeOffset);
- if (stats.dPingTime > 0.0)
- obj.pushKV("pingtime", stats.dPingTime);
+ if (stats.m_ping_usec > 0)
+ obj.pushKV("pingtime", stats.m_ping_usec / 1e6);
if (stats.dMinPing < static_cast<double>(std::numeric_limits<int64_t>::max())/1e6)
obj.pushKV("minping", stats.dMinPing);
if (stats.dPingWait > 0.0)