From c8b81162f3a9b5fec4685a7cdd9dc0f2bef07216 Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Tue, 30 Jan 2018 09:39:22 -0800 Subject: [PATCH] Ensure MessageQueue wait time calculations always use the same time unit! --- src/core/runtime/MessageQueue.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/runtime/MessageQueue.cpp b/src/core/runtime/MessageQueue.cpp index 789924370..66ff38f76 100755 --- a/src/core/runtime/MessageQueue.cpp +++ b/src/core/runtime/MessageQueue.cpp @@ -56,8 +56,11 @@ void MessageQueue::WaitAndDispatch(int64_t timeoutMillis) { this->queue.front()->time - system_clock::now().time_since_epoch()); - if (timeoutMillis >= 0 && waitTime.count() > timeoutMillis) { - waitTime = milliseconds(timeoutMillis); + if (timeoutMillis >= 0) { + auto timeoutDuration = milliseconds(timeoutMillis); + if (waitTime > timeoutDuration) { + waitTime = timeoutDuration; + } } if (waitTime.count() > 0) {