summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--osdep/threads.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/osdep/threads.c b/osdep/threads.c
index 9a53d5c5c0..dcc3965b1d 100644
--- a/osdep/threads.c
+++ b/osdep/threads.c
@@ -18,6 +18,7 @@
#include <time.h>
#include <unistd.h>
#include <sys/time.h>
+#include <limits.h>
#include "threads.h"
@@ -36,6 +37,8 @@ static void get_pthread_time(struct timespec *out_ts)
static void timespec_add_seconds(struct timespec *ts, double seconds)
{
+ if (seconds > INT_MAX)
+ seconds = INT_MAX;
unsigned long secs = (int)seconds;
unsigned long nsecs = (seconds - secs) * 1000000000UL;
if (nsecs + ts->tv_nsec >= 1000000000UL) {