diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..c550b4f --- /dev/null +++ b/src/util.h @@ -0,0 +1,21 @@ +#ifndef fooutilhfoo +#define fooutilhfoo + +#include <sys/time.h> +#include <time.h> +#include <inttypes.h> + +typedef uint64_t usec_t; + +usec_t timeval_diff(const struct timeval *a, const struct timeval *b); +int timeval_cmp(const struct timeval *a, const struct timeval *b); +usec_t timeval_age(const struct timeval *tv); +void timeval_add(struct timeval *tv, usec_t v); + +int set_nonblock(int fd); +int set_cloexec(int fd); + +int wait_for_write(int fd, struct timeval *end); +int wait_for_read(int fd, struct timeval *end); + +#endif |