Skip to content

Commit

Permalink
try using CLOCK_REALTIME -- a bad hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrady committed Feb 17, 2019
1 parent 984fc90 commit dc8483d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions audio_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int frame_size; // in bytes for interleaved stereo
int alsa_device_initialised; // boolean to ensure the initialisation is only
// done once
snd_pcm_t *alsa_handle = NULL;
int alsa_uses_monolithic_clock;
int alsa_uses_monotonic_clock = 0;
static snd_pcm_hw_params_t *alsa_params = NULL;
static snd_pcm_sw_params_t *alsa_swparams = NULL;
static snd_ctl_t *ctl = NULL;
Expand Down Expand Up @@ -459,8 +459,8 @@ int actual_open_alsa_device(void) {
return ret;
}

alsa_uses_monolithic_clock = snd_pcm_hw_params_is_monotonic (alsa_params);
debug(1,"alsa does%s use CLOCK_MONOLITHIC",alsa_uses_monolithic_clock ? "" : " not");
alsa_uses_monotonic_clock = snd_pcm_hw_params_is_monotonic(alsa_params);
debug(1,"alsa_uses_monotonic_clock is %d",alsa_uses_monotonic_clock);

debug (1,"sizeof time_t is: %d.", sizeof(time_t));
debug (1,"sizeof long is: %d.", sizeof(long));
Expand Down Expand Up @@ -1158,7 +1158,7 @@ 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);

clock_gettime(CLOCK_MONOTONIC, &tn);
clock_gettime(CLOCK_REALTIME, &tn);
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;
Expand Down

0 comments on commit dc8483d

Please sign in to comment.