mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
pthread: timespec.tv_nsec must be less then 1000000000 ns
This commit is contained in:

committed by
Anonymous Maarten

parent
3b7eafedb3
commit
2eeb39298e
@@ -114,7 +114,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms)
|
|||||||
abstime.tv_sec = delta.tv_sec + (ms / 1000);
|
abstime.tv_sec = delta.tv_sec + (ms / 1000);
|
||||||
abstime.tv_nsec = (long)(delta.tv_usec + (ms % 1000) * 1000) * 1000;
|
abstime.tv_nsec = (long)(delta.tv_usec + (ms % 1000) * 1000) * 1000;
|
||||||
#endif
|
#endif
|
||||||
if (abstime.tv_nsec > 1000000000) {
|
if (abstime.tv_nsec >= 1000000000) {
|
||||||
abstime.tv_sec += 1;
|
abstime.tv_sec += 1;
|
||||||
abstime.tv_nsec -= 1000000000;
|
abstime.tv_nsec -= 1000000000;
|
||||||
}
|
}
|
||||||
|
@@ -141,7 +141,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Wrap the second if needed */
|
/* Wrap the second if needed */
|
||||||
if (ts_timeout.tv_nsec > 1000000000) {
|
if (ts_timeout.tv_nsec >= 1000000000) {
|
||||||
ts_timeout.tv_sec += 1;
|
ts_timeout.tv_sec += 1;
|
||||||
ts_timeout.tv_nsec -= 1000000000;
|
ts_timeout.tv_nsec -= 1000000000;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user