From 94b67355c20ef61876e24f64709ada79334fb487 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Fri, 20 Oct 2023 17:41:31 -0500 Subject: [PATCH] timer: drop ancient macOS fallback macOS didn't support clock_gettime until 10.12 which was released roughly 7 years ago. Since we're breaking support for ancient OSes anyway, we might as well break some old macOS versions for fun. This makes 10.12 the minimum supported macOS version. --- README.md | 2 +- osdep/timer.c | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 5546647353..c74e3788e1 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Releases can be found on the [release list][releases]. ## System requirements -- A not too ancient Linux, Windows 10 or later, or macOS 10.8 or later. +- A not too ancient Linux, Windows 10 or later, or macOS 10.12 or later. - A somewhat capable CPU. Hardware decoding might help if the CPU is too slow to decode video in realtime, but must be explicitly enabled with the `--hwdec` option. diff --git a/osdep/timer.c b/osdep/timer.c index 6e8ce7d65f..0d5fade659 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -72,24 +72,10 @@ int64_t mp_time_ns_add(int64_t time_ns, double timeout_sec) return time_ns + ti; } -static int get_realtime(struct timespec *out_ts) -{ -#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 - return clock_gettime(CLOCK_REALTIME, out_ts); -#else - // OSX - struct timeval tv; - gettimeofday(&tv, NULL); - out_ts->tv_sec = tv.tv_sec; - out_ts->tv_nsec = tv.tv_usec * 1000UL; - return 0; -#endif -} - struct timespec mp_time_ns_to_realtime(int64_t time_ns) { struct timespec ts = {0}; - if (get_realtime(&ts) != 0) + if (clock_gettime(CLOCK_REALTIME, &ts) != 0) return ts; int64_t time_rel = time_ns - mp_time_ns();