Code

Merge commit 'refs/pull/18/head' of github.com:octo/liboping
authorFlorian Forster <ff@octo.it>
Sun, 19 Mar 2017 09:47:41 +0000 (10:47 +0100)
committerFlorian Forster <ff@octo.it>
Sun, 19 Mar 2017 09:47:41 +0000 (10:47 +0100)
Fixes: #17
configure.ac
src/oping.c

index aea4efba1b9d9c0d92ad30af0d89dfe3692d5f06..1d05f24cdd963f6f4df82204d058611d500594fe 100644 (file)
@@ -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"], [])
index f2e48a6c28b1b49359eeeff1ae689c9ae05339ff..de44d08b2f85e7222da053b3044fce06111faaae 100644 (file)
@@ -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");