Alternative to #18252, see motivation there.
This changes CNodeStats to handle ping timestamps as their original incoming usec int64_t values until the time they need to be displayed.
Concept ACK
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
170 | - if (stats.dMinPing < static_cast<double>(std::numeric_limits<int64_t>::max())/1e6) 171 | - obj.pushKV("minping", stats.dMinPing); 172 | - if (stats.dPingWait > 0.0) 173 | - obj.pushKV("pingwait", stats.dPingWait); 174 | + if (stats.m_ping_usec > 0) 175 | + obj.pushKV("pingtime", stats.m_ping_usec / 1e6);
Should cast to double first?
Done
Assuming x is int64_t, then all of these are equivalent:
x / 1e6;
(double)x / 1e6;
((double)x) / 1e6;
x / 1000000.0;
Indeed, I tend to prefer the explicit numerator cast though.
Concept ACK.
Note the divisor is a floating point literal so presumably
also floating point.
ACK 1891245e7318bf625bbf67aab08a79fc3e87b61d, added cast to double and also braces.
ACK 1891245
I tested this with Clang 10 and the warning is gone.
Nit: the cast to double added in 1891245 is not necessary (I am ok with it).
ACK 1891245e7318bf625bbf67aab08a79fc3e87b61d -- patch looks correct
Would be nice to add (functional) tests for this, since it is uncovered right now.