mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
Fix the build with old glibc
The old systems don't support CLOCK_MONOTONIC although clock_gettime() API itself exists. This causes compile errors.
This commit is contained in:
parent
12944a024f
commit
91726ddf83
3 changed files with 6 additions and 2 deletions
|
|
@ -944,13 +944,17 @@ 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 (monotonic) {
|
||||
clock_gettime(CLOCK_MONOTONIC, tstamp);
|
||||
} else {
|
||||
#endif
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue