diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-04-15 21:04:49 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2016-04-15 21:04:49 +0200 |
commit | c7577fa4ecf6f9858483c5d8b4a46e7caa2b376d (patch) | |
tree | 12e035c3be63b02359014fd55b55e7e5c1adcbf8 | |
parent | 0ae4539e7f42d21b3ebc8ec1914a32b5cf58d490 (diff) |
Fix Semaphore::wait(ms)
-rw-r--r-- | src/semaphore.cc | 4 |
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); |