snd_pcm_t *pcm;
snd_pcm_file_t *file;
snd_pcm_file_format_t format;
+ struct timespec timespec;
int err;
+
assert(pcmp);
if (fmt == NULL ||
strcmp(fmt, "raw") == 0)
pcm->poll_fd = slave->poll_fd;
pcm->poll_events = slave->poll_events;
pcm->mmap_shadow = 1;
- pcm->monotonic = 1;
+#ifdef HAVE_CLOCK_GETTIME
+ pcm->monotonic = clock_gettime(CLOCK_MONOTONIC, ×pec) == 0;
+#else
+ pcm->monotonic = 0;
+#endif
snd_pcm_link_hw_ptr(pcm, slave);
snd_pcm_link_appl_ptr(pcm, slave);
*pcmp = pcm;
#ifdef HAVE_CLOCK_GETTIME
if (SNDRV_PROTOCOL_VERSION(2, 0, 9) <= ver) {
- int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
- if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
- ret = -errno;
- SNDMSG("TTSTAMP failed\n");
- return ret;
+ struct timespec timespec;
+ if (clock_gettime(CLOCK_MONOTONIC, ×pec) == 0) {
+ int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
+ if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
+ ret = -errno;
+ SNDMSG("TTSTAMP failed\n");
+ return ret;
+ }
+ monotonic = 1;
}
- monotonic = 1;
}
#endif
else if (SNDRV_PROTOCOL_VERSION(2, 0, 5) <= ver) {