From: Florian Forster Date: Sun, 19 Mar 2017 09:47:41 +0000 (+0100) Subject: Merge commit 'refs/pull/18/head' of github.com:octo/liboping X-Git-Url: https://git.tokkee.org/?p=liboping.git;a=commitdiff_plain;h=5bacc4ccaee4b44b1f45b8e589797ba9a4001cba;hp=de2e53623737bbd78a7e14a8a8e016fbc5f2e397 Merge commit 'refs/pull/18/head' of github.com:octo/liboping Fixes: #17 --- diff --git a/configure.ac b/configure.ac index aea4efb..1d05f24 100644 --- a/configure.ac +++ b/configure.ac @@ -201,8 +201,6 @@ AC_SUBST(LIBOPING_PC_LIBS_PRIVATE) AC_SEARCH_LIBS([nanosleep],[rt],[], [AC_MSG_ERROR([cannot find nanosleep])]) -AC_SEARCH_LIBS([clock_gettime],[rt],[], - [AC_MSG_ERROR([cannot find clock_gettime])]) with_ncurses="no" AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], []) diff --git a/src/oping.c b/src/oping.c index f2e48a6..de44d08 100644 --- a/src/oping.c +++ b/src/oping.c @@ -1615,11 +1615,10 @@ static void update_host_hook (pingobj_iter_t *iter, /* {{{ */ if (outfile != NULL) { - struct timespec ts = { 0, 0 }; - - if (clock_gettime (CLOCK_REALTIME, &ts) == 0) + struct timeval tv = {0}; + if (gettimeofday (&tv, NULL) == 0) { - double t = ((double) ts.tv_sec) + (((double) ts.tv_nsec) / 1000000000.0); + double t = ((double) tv.tv_sec) + (((double) tv.tv_usec) / 1000000.0); if ((sequence % 32) == 0) fprintf (outfile, "#time,host,latency[ms]\n");