diff options
author | Nathan Hjelm <hjelmn@mac.com> | 2009-02-16 21:25:18 -0300 |
---|---|---|
committer | Daniel Drake <dsd@gentoo.org> | 2009-02-16 21:25:51 -0300 |
commit | 9196f58bdc8b9e967261df39865215faa5d39cfa (patch) | |
tree | 68cda454a4a72c0ac77553b91c9802c8d4fad65e /libusb/libusbi.h | |
parent | e91207860cac09b3afaafc4c14221b78d585c59a (diff) | |
download | libusb-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/libusbi.h')
-rw-r--r-- | libusb/libusbi.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h index b51ba0b..da636b2 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -218,6 +218,11 @@ struct libusb_device_handle { #define USBI_TRANSFER_TIMED_OUT (1<<0) +enum { + USBI_CLOCK_MONOTONIC, + USBI_CLOCK_REALTIME +}; + /* in-memory transfer layout: * * 1. struct usbi_transfer @@ -733,6 +738,16 @@ struct usbi_os_backend { int (*handle_events)(struct libusb_context *ctx, struct pollfd *fds, nfds_t nfds, int num_ready); + /* Get time from specified clock. At least two clocks must be implemented + by the backend: USBI_CLOCK_REALTIME, and USBI_CLOCK_MONOTONIC. + + Description of clocks: + USBI_CLOCK_REALTIME : clock returns time since system epoch. + USBI_CLOCK_MONOTONIC: clock returns time since unspecified start + time (usually boot). + */ + int (*clock_gettime)(int clkid, struct timespec *tp); + /* Number of bytes to reserve for per-device private backend data. * This private data area is accessible through the "os_priv" field of * struct libusb_device. */ |