aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/containers.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-11-22 16:49:56 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-11-22 18:32:48 +0100
commitbc1f6be5dbcfe60cec053825b5efe73cff729844 (patch)
tree09070df9b18047e8e300c1db616ce12fc9188866 /src/containers.h
parentwg: tighten up strtoul parsing (diff)
downloadwireguard-tools-bc1f6be5dbcfe60cec053825b5efe73cff729844.tar.xz
wireguard-tools-bc1f6be5dbcfe60cec053825b5efe73cff729844.zip
global: switch from timeval to timespec
This gets us nanoseconds instead of microseconds, which is better, and we can do this pretty much without freaking out existing userspace, which doesn't actually make use of the nano/micro seconds field: zx2c4@thinkpad ~ $ cat a.c void main() { puts(sizeof(struct timeval) == sizeof(struct timespec) ? "success" : "failure"); } zx2c4@thinkpad ~ $ gcc a.c -m64 && ./a.out success zx2c4@thinkpad ~ $ gcc a.c -m32 && ./a.out success This doesn't solve y2038 problem, but timespec64 isn't yet a thing in userspace. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/containers.h')
-rw-r--r--src/containers.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/containers.h b/src/containers.h
index 58d0657..31eabea 100644
--- a/src/containers.h
+++ b/src/containers.h
@@ -6,9 +6,9 @@
#include <stdint.h>
#include <stdlib.h>
+#include <time.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <sys/time.h>
#include <sys/socket.h>
#include "../uapi/wireguard.h"
@@ -43,7 +43,7 @@ struct wgpeer {
struct sockaddr_in6 addr6;
} endpoint;
- struct timeval last_handshake_time;
+ struct timespec last_handshake_time;
uint64_t rx_bytes, tx_bytes;
uint16_t persistent_keepalive_interval;