summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/Thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/Src/Thread.cpp')
-rw-r--r--Source/Core/Common/Src/Thread.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp
index e06c91170a..2788a4583e 100644
--- a/Source/Core/Common/Src/Thread.cpp
+++ b/Source/Core/Common/Src/Thread.cpp
@@ -492,15 +492,11 @@ namespace Common
if (timeout != INFINITE)
{
- struct timeval now;
- gettimeofday(&now, NULL);
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC_RAW, &now);
memset(&wait, 0, sizeof(wait));
- //TODO: timespec also has nanoseconds, but do we need them?
- //as consequence, waiting is limited to seconds for now.
- //the following just looks ridiculous, and probably fails for
- //values 429 < ms <= 999 since it overflows the long.
- //wait.tv_nsec = (now.tv_usec + (timeout % 1000) * 1000) * 1000);
+ wait.tv_nsec = now.tv_nsec + (timeout % 1000) * 1000000;
wait.tv_sec = now.tv_sec + (timeout / 1000);
}