diff options
Diffstat (limited to 'Source/Core/Common/Src/Thread.cpp')
| -rw-r--r-- | Source/Core/Common/Src/Thread.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index 2788a4583e..aeee52ca22 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -492,11 +492,16 @@ namespace Common if (timeout != INFINITE) { + memset(&wait, 0, sizeof(wait)); +#ifdef USE_GETTIMEOFDAY + struct timeval now; + gettimeofday(&now, NULL); + wait.tv_nsec = (now.tv_usec + (timeout % 1000)) * 1000; +#else struct timespec now; clock_gettime(CLOCK_MONOTONIC_RAW, &now); - - memset(&wait, 0, sizeof(wait)); wait.tv_nsec = now.tv_nsec + (timeout % 1000) * 1000000; +#endif wait.tv_sec = now.tv_sec + (timeout / 1000); } |
