]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix the build with old glibc
authorTakashi Iwai <tiwai@suse.de>
Fri, 7 Mar 2008 13:35:25 +0000 (14:35 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 7 Mar 2008 13:35:25 +0000 (14:35 +0100)
The old systems don't support CLOCK_MONOTONIC although clock_gettime() API
itself exists.  This causes compile errors.

src/pcm/pcm_file.c
src/pcm/pcm_hw.c
src/pcm/pcm_local.h

index 4b8eaa5c6efb0b540a7cbf835aa8249adef8d98c..a006696c4e742a2f845012c6d0ea092311996344 100644 (file)
@@ -469,7 +469,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
        pcm->poll_fd = slave->poll_fd;
        pcm->poll_events = slave->poll_events;
        pcm->mmap_shadow = 1;
-#ifdef HAVE_CLOCK_GETTIME
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
        pcm->monotonic = clock_gettime(CLOCK_MONOTONIC, &timespec) == 0;
 #else
        pcm->monotonic = 0;
index 8495f71b49237de381b8b89081331ea74c22c5d9..1b103b52bdbee96357d6ff14289b3a6b513122a5 100644 (file)
@@ -994,7 +994,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
        if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_PCM_VERSION_MAX))
                return -SND_ERROR_INCOMPATIBLE_VERSION;
 
-#ifdef HAVE_CLOCK_GETTIME
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
        if (SNDRV_PROTOCOL_VERSION(2, 0, 9) <= ver) {
                struct timespec timespec;
                if (clock_gettime(CLOCK_MONOTONIC, &timespec) == 0) {
index 8d4ae40039ceb9f4d2281cdfd1498cd9f963e717..661d40eebc2f87f9fd18f682febe77aa7537d647 100644 (file)
@@ -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
 }