diff options
author | wm4 <wm4@nowhere> | 2014-03-09 16:58:00 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-09 16:58:00 +0100 |
commit | 3ca034228dc54b359c8ff696bd7a8ba59f08a139 (patch) | |
tree | 6d848cb7a325ac83daaa6b2f0dd5642e1e61cf9c /osdep | |
parent | 3620cf97ad97239f3f39093c1c86acc336342b66 (diff) | |
download | mpv-3ca034228dc54b359c8ff696bd7a8ba59f08a139.tar.bz2 mpv-3ca034228dc54b359c8ff696bd7a8ba59f08a139.tar.xz |
timer: reduce ifdef headsplitting-factor
I'd rather duplicate some trivial code, rather than split functions in
the middle with ifdefs.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/timer-linux.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/osdep/timer-linux.c b/osdep/timer-linux.c index 4ab19b6490..2424cc653d 100644 --- a/osdep/timer-linux.c +++ b/osdep/timer-linux.c @@ -1,5 +1,5 @@ /* - * precise timer routines for Linux + * precise timer routines for Linux/UNIX * copyright (C) LGB & A'rpi/ASTRAL * * This file is part of MPlayer. @@ -26,19 +26,24 @@ #include "config.h" #include "timer.h" +#if HAVE_NANOSLEEP void mp_sleep_us(int64_t us) { if (us < 0) return; -#if HAVE_NANOSLEEP struct timespec ts; ts.tv_sec = us / 1000000; ts.tv_nsec = (us % 1000000) * 1000; nanosleep(&ts, NULL); +} #else +void mp_sleep_us(int64_t us) +{ + if (us < 0) + return; usleep(us); -#endif } +#endif #if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC) uint64_t mp_raw_time_us(void) |