]> err.no Git - linux-2.6/blobdiff - include/sound/pcm.h
[ALSA] Use posix clock monotonic for PCM and timer timestamps
[linux-2.6] / include / sound / pcm.h
index 5e9cc460075efa5ee9726d0cb282218f67355100..65f636223d392890283e16df109aea34ade635ce 100644 (file)
@@ -323,6 +323,7 @@ struct snd_pcm_runtime {
 
        /* -- timer -- */
        unsigned int timer_resolution;  /* timer resolution */
+       int tstamp_type;                /* timestamp type */
 
        /* -- DMA -- */           
        unsigned char *dma_area;        /* DMA area */
@@ -952,6 +953,15 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
 void snd_pcm_timer_init(struct snd_pcm_substream *substream);
 void snd_pcm_timer_done(struct snd_pcm_substream *substream);
 
+static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
+                                  struct timespec *tv)
+{
+       if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC)
+               do_posix_clock_monotonic_gettime(tv);
+       else
+               getnstimeofday(tv);
+}
+
 /*
  *  Memory
  */