diff options
Diffstat (limited to 'src/mongo/client/sdam/server_description.cpp')
-rw-r--r-- | src/mongo/client/sdam/server_description.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/client/sdam/server_description.cpp b/src/mongo/client/sdam/server_description.cpp index 08500bbe2db..93138d222a6 100644 --- a/src/mongo/client/sdam/server_description.cpp +++ b/src/mongo/client/sdam/server_description.cpp @@ -171,8 +171,10 @@ void ServerDescription::calculateRtt(const boost::optional<IsMasterRTT> currentR _rtt = currentRtt; } else { // new_rtt = alpha * x + (1 - alpha) * old_rtt - _rtt = IsMasterRTT(static_cast<IsMasterRTT::rep>(kRttAlpha * currentRtt.get().count() + - (1 - kRttAlpha) * lastRtt.get().count())); + auto currentMicros = durationCount<Microseconds>(*currentRtt); + auto lastMicros = durationCount<Microseconds>(*lastRtt); + _rtt = Microseconds(static_cast<Microseconds::rep>(kRttAlpha * currentMicros + + (1 - kRttAlpha) * lastMicros)); } } |