diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-13 20:01:48 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-10-13 20:01:48 +0200 |
commit | bc9f976d7fe70176aac4bc9c87205d6ac1f530cc (patch) | |
tree | 538690a93e5a2282710bc623ec8b23312998c605 /ffd/util.h | |
parent | 8e810f5fd809bad3047ea9224dd058edd20a64ac (diff) | |
download | ffd-bc9f976d7fe70176aac4bc9c87205d6ac1f530cc.tar ffd-bc9f976d7fe70176aac4bc9c87205d6ac1f530cc.zip |
Add timeout queues
Diffstat (limited to 'ffd/util.h')
-rw-r--r-- | ffd/util.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -34,6 +34,9 @@ #include <time.h> +extern struct timespec now; + + bool file_readv(const char *file, const char *format, va_list ap); void random_bytes(void *buffer, size_t len); @@ -53,6 +56,11 @@ static inline bool are_eth_addrs_equal(const eth_addr_t *address1, const eth_add return (a[0]==b[0] && a[1]==b[1] && a[2]==b[2] && a[3]==b[3] && a[4]==b[4] && a[5]==b[5]); } +static inline bool timespec_after(const struct timespec *tp1, const struct timespec *tp2) { + return (tp1->tv_sec > tp2->tv_sec || + (tp1->tv_sec == tp2->tv_sec && tp1->tv_nsec > tp2->tv_nsec)); +} + /* returns (tp1 - tp2) in centiseconds */ static inline int timespec_diff(const struct timespec *tp1, const struct timespec *tp2) { return ((tp1->tv_sec - tp2->tv_sec))*100 + (tp1->tv_nsec - tp2->tv_nsec)/1e7; |