summaryrefslogtreecommitdiffstats
path: root/raul
diff options
context:
space:
mode:
Diffstat (limited to 'raul')
-rw-r--r--raul/Semaphore.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/raul/Semaphore.hpp b/raul/Semaphore.hpp
index dbebf06..9979a09 100644
--- a/raul/Semaphore.hpp
+++ b/raul/Semaphore.hpp
@@ -134,8 +134,9 @@ Semaphore::try_wait()
inline bool
Semaphore::timed_wait(unsigned ms)
{
- const unsigned seconds = ms / 1000;
- const mach_timespec_t t = { seconds, (ms - (seconds * 1000)) * 1000000 };
+ const unsigned s = ms / 1000;
+ const int nsec = ((int)ms - (s * 1000)) * 1000000;
+ const mach_timespec_t t = { s, nsec };
return semaphore_timedwait(_sem, t) == KERN_SUCCESS;
}