diff --git a/src/condition_variable.hpp b/src/condition_variable.hpp index 4e20b401..7e2ad89b 100644 --- a/src/condition_variable.hpp +++ b/src/condition_variable.hpp @@ -164,6 +164,12 @@ namespace zmq timeout.tv_sec += timeout_ / 1000; timeout.tv_nsec += (timeout_ % 1000) * 1000000; + + if (timeout.tv_nsec > 1E9) { + timeout.tv_sec++; + timeout.tv_nsec -= 1E9; + } + rc = pthread_cond_timedwait (&cond, mutex_->get_mutex (), &timeout); } else