From b69d57ebe87cb43ea29ce7b7146d63338b7ed3e7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 23 May 2014 00:20:57 +0200 Subject: timer: workaround for crappy operating systems Some operating systems apparently can't deal with really long timeouts in pthread_cond_timedwait(). Passing a time about 300000 in the future makes the call return immediately. (tv_sec/time_t doesn't overflow in this situation.) Reduce the wait time to about 100 days, which seems to work fine. The list of affected OSes follows: OSX --- osdep/timer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'osdep/timer.c') diff --git a/osdep/timer.c b/osdep/timer.c index 583a94c28a..8dd5915b72 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -119,6 +119,7 @@ struct timespec mp_time_us_to_timespec(int64_t time_us) diff_secs += 1; diff_nsecs -= 1000000000UL; } + diff_secs = MPMIN(diff_secs, 10000000); if (diff_secs > MAX_TIME_T - ts.tv_sec) diff_secs = MAX_TIME_T - ts.tv_sec; ts.tv_sec += diff_secs; -- cgit v1.2.3