Fix calculation of absolute timeout when using pthread_cond_timedwait.

This commit is contained in:
Christopher Kohlhoff 2019-02-28 10:50:27 +11:00
parent 30e38527a4
commit bc7e0f38cf

View File

@ -129,7 +129,7 @@ public:
if (::clock_gettime(CLOCK_MONOTONIC, &ts) == 0) if (::clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
{ {
ts.tv_sec += usec / 1000000; ts.tv_sec += usec / 1000000;
ts.tv_nsec = (usec % 1000000) * 1000; ts.tv_nsec += (usec % 1000000) * 1000;
ts.tv_sec += ts.tv_nsec / 1000000000; ts.tv_sec += ts.tv_nsec / 1000000000;
ts.tv_nsec = ts.tv_nsec % 1000000000; ts.tv_nsec = ts.tv_nsec % 1000000000;
::pthread_cond_timedwait(&cond_, ::pthread_cond_timedwait(&cond_,