diff options
author | Olivier Langlois <olivier@trillion01.com> | 2014-01-23 19:03:00 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-01-24 13:54:15 +0100 |
commit | 66f07aa3b77e4013110f7b12640e204d0c15ac8d (patch) | |
tree | 89c2b856c23b010fc6d17e9935d330e614dc76cd | |
parent | 507cdc13187f5eeb222eeb43550cf6a67c3b29c9 (diff) | |
download | alsa-lib-66f07aa3b77e4013110f7b12640e204d0c15ac8d.tar.gz |
pcm: use CLOCK_REALTIME for non-monotonic ts
gettimeofday() is the same than clock_gettime(CLOCK_REALTIME)
except for the loss of precision and the double unnecessary
conversion timespec <-> timeval.
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | src/pcm/pcm_local.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index e1c0baa8..8a6c7431 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -961,17 +961,21 @@ typedef union snd_tmp_double { /* get the current timestamp */ static inline void gettimestamp(snd_htimestamp_t *tstamp, int monotonic) { -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) +#if defined(HAVE_CLOCK_GETTIME) +#if defined(CLOCK_MONOTONIC) if (monotonic) { clock_gettime(CLOCK_MONOTONIC, tstamp); } else { #endif + clock_gettime(CLOCK_REALTIME, tstamp); +#else struct timeval tv; gettimeofday(&tv, 0); tstamp->tv_sec = tv.tv_sec; tstamp->tv_nsec = tv.tv_usec * 1000L; -#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) +#endif +#if defined(HAVE_CLOCK_GETTIME) } #endif } |