From 2c8d1dfc711564d2e8ec6297969e760fc71f6b83 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 17 Feb 2019 13:52:38 +0000 Subject: [PATCH] use CLOCK_REALTIME if alsa is earlier than 1.0.28 --- audio_alsa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/audio_alsa.c b/audio_alsa.c index 2b8d2045..01882639 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -1158,7 +1158,12 @@ int delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay) { if (*state == SND_PCM_STATE_DRAINING) debug(1, "alsa: draining with a delay of %d.", delay); +#if SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR < 28 clock_gettime(CLOCK_REALTIME, &tn); +#else + clock_gettime(CLOCK_MONOTONIC, &tn); +#endif + uint64_t time_now_ns = tn.tv_sec * (uint64_t)1000000000 + tn.tv_nsec; uint64_t update_timestamp_ns = update_timestamp.tv_sec * (uint64_t)1000000000 + update_timestamp.tv_nsec;