summaryrefslogtreecommitdiff
path: root/src/semaphore.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/semaphore.cc')
-rw-r--r--src/semaphore.cc4
1 files 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);