summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/curop.h')
-rw-r--r--src/mongo/db/curop.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index 6f0478c8cc7..54762580f79 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -556,8 +556,8 @@ public:
if (_debug.remoteOpWaitTime) {
Microseconds end = elapsedTimeTotal();
invariant(_remoteOpStartTime);
- invariant(*_remoteOpStartTime <= end);
- Microseconds delta = end - *_remoteOpStartTime;
+ // A backward shift of the realtime system clock could lead to a negative delta.
+ Microseconds delta = std::max((end - *_remoteOpStartTime), Microseconds{0});
*_debug.remoteOpWaitTime += delta;
_remoteOpStartTime = boost::none;
}