diff options
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/compiler.h | 5 | ||||
-rw-r--r-- | osdep/subprocess-posix.c | 3 | ||||
-rw-r--r-- | osdep/subprocess-win.c | 1 | ||||
-rw-r--r-- | osdep/timer.c | 10 | ||||
-rw-r--r-- | osdep/timer.h | 7 |
5 files changed, 10 insertions, 16 deletions
diff --git a/osdep/compiler.h b/osdep/compiler.h index d25f0cd1e4..7c9f859f3a 100644 --- a/osdep/compiler.h +++ b/osdep/compiler.h @@ -17,5 +17,10 @@ #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2))) #endif +#if __STDC_VERSION__ >= 201112L +#include <stdalign.h> +#else +#define alignof(x) (offsetof(struct {char unalign_; x u;}, u)) +#endif #endif diff --git a/osdep/subprocess-posix.c b/osdep/subprocess-posix.c index a5fe43c6d4..ff78eb42f8 100644 --- a/osdep/subprocess-posix.c +++ b/osdep/subprocess-posix.c @@ -26,8 +26,9 @@ #include "osdep/subprocess.h" -#include "osdep/io.h" #include "common/common.h" +#include "misc/thread_tools.h" +#include "osdep/io.h" #include "stream/stream.h" extern char **environ; diff --git a/osdep/subprocess-win.c b/osdep/subprocess-win.c index bbb1f6f7fd..b5a9e1a24d 100644 --- a/osdep/subprocess-win.c +++ b/osdep/subprocess-win.c @@ -27,6 +27,7 @@ #include "common/common.h" #include "stream/stream.h" #include "misc/bstr.h" +#include "misc/thread_tools.h" static void write_arg(bstr *cmdline, char *arg) { diff --git a/osdep/timer.c b/osdep/timer.c index f75aec76f3..c624b66e70 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -59,16 +59,6 @@ double mp_time_sec(void) return mp_time_us() / (double)(1000 * 1000); } -int64_t mp_time_relative_us(int64_t *t) -{ - int64_t r = 0; - int64_t now = mp_time_us(); - if (*t) - r = now - *t; - *t = now; - return r; -} - int64_t mp_add_timeout(int64_t time_us, double timeout_sec) { assert(time_us > 0); // mp_time_us() returns strictly positive values diff --git a/osdep/timer.h b/osdep/timer.h index b4a64c7820..be5e9c0467 100644 --- a/osdep/timer.h +++ b/osdep/timer.h @@ -39,11 +39,8 @@ void mp_sleep_us(int64_t us); #define MP_START_TIME 10000000 -// Return the amount of time that has passed since the last call, in -// microseconds. *t is used to calculate the time that has passed by storing -// the current time in it. If *t is 0, the call will return 0. (So that the -// first call will return 0, instead of the absolute current time.) -int64_t mp_time_relative_us(int64_t *t); +// Duration of a second in mpv time. +#define MP_SECOND_US (1000 * 1000) // Add a time in seconds to the given time in microseconds, and return it. // Takes care of possible overflows. Never returns a negative or 0 time. |