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-05 11:53:18 +0100
commit96a33edad39521f7e228c8122a713d1972a38ca9 (patch)
tree797a72540af3160387adf96abd7b77dd3e05ae29
parent9e172a7829e4a63c79e31ef39aae11fc56633d84 (diff)
downloadlibusb-96a33edad39521f7e228c8122a713d1972a38ca9.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 ed1ce13..0c6ed95 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 */