From c7577fa4ecf6f9858483c5d8b4a46e7caa2b376d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 15 Apr 2016 21:04:49 +0200 Subject: Fix Semaphore::wait(ms) --- src/semaphore.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/semaphore.cc b/src/semaphore.cc index 3a4f6c9..6172251 100644 --- a/src/semaphore.cc +++ b/src/semaphore.cc @@ -95,10 +95,10 @@ bool Semaphore::wait(const std::chrono::milliseconds& timeout) #else struct timespec t = { // Whole seconds: - (time_t)(timeout.count() % 1000), + (time_t)(timeout.count() / 1000), // Remainder as nanoseconds: - (long)((timeout.count() - (t.tv_sec * timeout.count())) * 1000000) + (long)((timeout.count() - ((timeout.count() / 1000) * 1000)) * 1000000) }; int ret = sem_timedwait(&prv->semaphore, &t); -- cgit v1.2.3