summaryrefslogtreecommitdiffstats
path: root/ffd/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/util.h')
-rw-r--r--ffd/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/ffd/util.h b/ffd/util.h
index 9d481cb..0660b94 100644
--- a/ffd/util.h
+++ b/ffd/util.h
@@ -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;