summaryrefslogtreecommitdiff
path: root/libusb/io.c
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@mac.com>2009-02-16 21:25:18 -0300
committerDaniel Drake <dsd@gentoo.org>2009-02-16 21:25:51 -0300
commit9196f58bdc8b9e967261df39865215faa5d39cfa (patch)
tree68cda454a4a72c0ac77553b91c9802c8d4fad65e /libusb/io.c
parente91207860cac09b3afaafc4c14221b78d585c59a (diff)
downloadlibusb-9196f58bdc8b9e967261df39865215faa5d39cfa.tar.gz
Abstract clock reading into OS layer
This will differ on Linux and Darwin, at least. [dsd: minor style tweaks]
Diffstat (limited to 'libusb/io.c')
-rw-r--r--libusb/io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libusb/io.c b/libusb/io.c
index b053f85..6c3aadb 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -972,7 +972,7 @@ static int calculate_timeout(struct usbi_transfer *transfer)
if (!timeout)
return 0;
- r = clock_gettime(CLOCK_MONOTONIC, &current_time);
+ r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &current_time);
if (r < 0) {
usbi_err(ITRANSFER_CTX(transfer),
"failed to read monotonic clock, errno=%d", errno);
@@ -1445,7 +1445,7 @@ API_EXPORTED int libusb_wait_for_event(libusb_context *ctx, struct timeval *tv)
return 0;
}
- r = clock_gettime(CLOCK_REALTIME, &timeout);
+ r = usbi_backend->clock_gettime(USBI_CLOCK_REALTIME, &timeout);
if (r < 0) {
usbi_err(ctx, "failed to read realtime clock, error %d", errno);
return LIBUSB_ERROR_OTHER;
@@ -1489,7 +1489,7 @@ static int handle_timeouts(struct libusb_context *ctx)
goto out;
/* get current time */
- r = clock_gettime(CLOCK_MONOTONIC, &systime_ts);
+ r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &systime_ts);
if (r < 0)
goto out;
@@ -1807,7 +1807,7 @@ API_EXPORTED int libusb_get_next_timeout(libusb_context *ctx,
return 0;
}
- r = clock_gettime(CLOCK_MONOTONIC, &cur_ts);
+ r = usbi_backend->clock_gettime(USBI_CLOCK_MONOTONIC, &cur_ts);
if (r < 0) {
usbi_err(ctx, "failed to read monotonic clock, errno=%d", errno);
return LIBUSB_ERROR_OTHER;