From: Mike Brady Date: Sun, 17 Feb 2019 13:52:38 +0000 (+0000) Subject: use CLOCK_REALTIME if alsa is earlier than 1.0.28 X-Git-Tag: 3.3RC0~55^2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c8d1dfc711564d2e8ec6297969e760fc71f6b83;p=thirdparty%2Fshairport-sync.git use CLOCK_REALTIME if alsa is earlier than 1.0.28 --- 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;