summaryrefslogtreecommitdiffstats
path: root/util.h
blob: c550b4feaa1be1721435a574057469d30ebea572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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