mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
refactor: Cast ping values to double before output
Note the divisor is a floating point literal so presumably also floating point.
This commit is contained in:
parent
7a810b1d7a
commit
1891245e73
1 changed files with 9 additions and 6 deletions
|
@ -165,12 +165,15 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
|
|||
obj.pushKV("bytesrecv", stats.nRecvBytes);
|
||||
obj.pushKV("conntime", stats.nTimeConnected);
|
||||
obj.pushKV("timeoffset", stats.nTimeOffset);
|
||||
if (stats.m_ping_usec > 0)
|
||||
obj.pushKV("pingtime", stats.m_ping_usec / 1e6);
|
||||
if (stats.m_min_ping_usec < std::numeric_limits<int64_t>::max())
|
||||
obj.pushKV("minping", stats.m_min_ping_usec / 1e6);
|
||||
if (stats.m_ping_wait_usec > 0)
|
||||
obj.pushKV("pingwait", stats.m_ping_wait_usec / 1e6);
|
||||
if (stats.m_ping_usec > 0) {
|
||||
obj.pushKV("pingtime", ((double)stats.m_ping_usec) / 1e6);
|
||||
}
|
||||
if (stats.m_min_ping_usec < std::numeric_limits<int64_t>::max()) {
|
||||
obj.pushKV("minping", ((double)stats.m_min_ping_usec) / 1e6);
|
||||
}
|
||||
if (stats.m_ping_wait_usec > 0) {
|
||||
obj.pushKV("pingwait", ((double)stats.m_ping_wait_usec) / 1e6);
|
||||
}
|
||||
obj.pushKV("version", stats.nVersion);
|
||||
// Use the sanitized form of subver here, to avoid tricksy remote peers from
|
||||
// corrupting or modifying the JSON output by putting special characters in
|
||||
|
|
Loading…
Add table
Reference in a new issue