mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
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>
This commit is contained in:
parent
507cdc1318
commit
66f07aa3b7
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue