Ensure MessageQueue wait time calculations always use the same time

unit!
This commit is contained in:
Casey Langen 2018-01-30 09:39:22 -08:00
parent 0fdb83d643
commit c8b81162f3

View File

@ -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) {