From 31afa3d8d6499d119bdf54bd37820b630c9e37e9 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Mon, 19 Oct 2020 03:00:33 +0000 Subject: [PATCH] calculating request time as struct timespec --- main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index 721f769..166394e 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <time.h> #include "dns.h" int main(int argc, char** argv) @@ -45,7 +46,9 @@ } } unsigned char buf[65536]; - resolve(buf, hostname, server, type); + struct timespec time; + time = resolve(buf, hostname, server, type); + printf("Request took %ld.%09lds\n", time.tv_sec, time.tv_nsec); print_packet(buf); return 0; } -- Gitblit v1.10.0