diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-22 16:49:56 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-11-22 18:32:48 +0100 |
commit | 314c17259e09d18af9fcafa9d7e8b59c5cf1e1ca (patch) | |
tree | 92c96f7aca12855ba83431de6d766568664f1e97 /src/tools/ipc.c | |
parent | poly1305: import MIPS64 primitive from OpenSSL (diff) | |
download | wireguard-monolithic-historical-314c17259e09d18af9fcafa9d7e8b59c5cf1e1ca.tar.xz wireguard-monolithic-historical-314c17259e09d18af9fcafa9d7e8b59c5cf1e1ca.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.
Diffstat (limited to 'src/tools/ipc.c')
-rw-r--r-- | src/tools/ipc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/ipc.c b/src/tools/ipc.c index 2d24287..a88672f 100644 --- a/src/tools/ipc.c +++ b/src/tools/ipc.c @@ -427,7 +427,7 @@ static int userspace_get_device(struct wgdevice **out, const char *interface) } else if (peer && !strcmp(key, "last_handshake_time_sec")) peer->last_handshake_time.tv_sec = NUM(0xffffffffffffffffULL); else if (peer && !strcmp(key, "last_handshake_time_nsec")) - peer->last_handshake_time.tv_usec = NUM(0xffffffffffffffffULL) / 1000; + peer->last_handshake_time.tv_nsec = NUM(0xffffffffffffffffULL); else if (peer && !strcmp(key, "rx_bytes")) peer->rx_bytes = NUM(0xffffffffffffffffULL); else if (peer && !strcmp(key, "tx_bytes")) |