summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-08-20 00:09:46 -0400
committerDaniel Drake <dan@reactivated.net>2010-10-04 19:57:17 +0100
commita9b4065f048e750b7317f6434406fd528b69bf33 (patch)
treeaffb84d7bcacbde257c59e98249ecc02755ad2ad
parentd192c5bd32736fde0080d756de6221287af34891 (diff)
downloadlibusb-a9b4065f048e750b7317f6434406fd528b69bf33.tar.gz
Linux: fix build failure when CLOCK_MONOTONIC does not exist
This is not available on all platforms.
-rw-r--r--libusb/os/linux_usbfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index d0db7e2..96ae135 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -201,15 +201,16 @@ static clockid_t find_monotonic_clock(void)
struct timespec ts;
int r;
+#ifdef CLOCK_MONOTONIC
/* Linux 2.6.28 adds CLOCK_MONOTONIC_RAW but we don't use it
* because it's not available through timerfd */
r = clock_gettime(CLOCK_MONOTONIC, &ts);
- if (r == 0) {
+ if (r == 0)
return CLOCK_MONOTONIC;
- } else {
- usbi_dbg("monotonic clock doesn't work, errno %d", errno);
- return CLOCK_REALTIME;
- }
+ usbi_dbg("monotonic clock doesn't work, errno %d", errno);
+#endif
+
+ return CLOCK_REALTIME;
}
/* bulk continuation URB flag available from Linux 2.6.32 */