Alien-cares

 view release on metacpan or  search on metacpan

libcares/acinclude.m4  view on Meta::CPAN

        AC_MSG_RESULT([no])
        AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
        ac_cv_func_clock_gettime="no"
        LIBS="$curl_cv_save_LIBS"
      ])
    fi
    #
    case "$ac_cv_func_clock_gettime" in
      yes)
        AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
          [Define to 1 if you have the clock_gettime function and monotonic timer.])
        ;;
    esac
    #
  fi
  #
])


dnl CARES_CHECK_LIBS_CONNECT
dnl -------------------------------------------------

libcares/ares_config.h.cmake  view on Meta::CPAN


/* Define to 1 if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H

/* Define to 1 if you have the `bitncmp' function. */
#cmakedefine HAVE_BITNCMP

/* Define to 1 if bool is an available type. */
#cmakedefine HAVE_BOOL_T

/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC

/* Define to 1 if you have the closesocket function. */
#cmakedefine HAVE_CLOSESOCKET

/* Define to 1 if you have the CloseSocket camel case function. */
#cmakedefine HAVE_CLOSESOCKET_CAMEL

/* Define to 1 if you have the connect function. */
#cmakedefine HAVE_CONNECT

libcares/ares_config.h.in  view on Meta::CPAN


/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H

/* Define to 1 if you have the `bitncmp' function. */
#undef HAVE_BITNCMP

/* Define to 1 if bool is an available type. */
#undef HAVE_BOOL_T

/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#undef HAVE_CLOCK_GETTIME_MONOTONIC

/* Define to 1 if you have the closesocket function. */
#undef HAVE_CLOSESOCKET

/* Define to 1 if you have the CloseSocket camel case function. */
#undef HAVE_CLOSESOCKET_CAMEL

/* Define to 1 if you have the connect function. */
#undef HAVE_CONNECT

libcares/configure.ac  view on Meta::CPAN

   ]])
  ],[
    AC_MSG_RESULT([yes])
    ac_cv_macos_10_12="yes"
  ],[
    AC_MSG_RESULT([no])
  ])
])

dnl **********************************************************************
dnl In case that function clock_gettime with monotonic timer is available,
dnl check for additional required libraries.
dnl **********************************************************************
dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will
dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will
dnl cause a crash at runtime when running on older versions.  Skip finding CLOCK_MONOTONIC on older
dnl Apple OS's.
if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
  CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
fi

libcares/test/ares-test-misc.cc  view on Meta::CPAN


TEST_F(DefaultChannelTest, TimeoutValue) {
  struct timeval tinfo;
  tinfo.tv_sec = 0;
  tinfo.tv_usec = 0;
  struct timeval tmax;
  tmax.tv_sec = 0;
  tmax.tv_usec = 10;
  struct timeval* pt;

  // No timers => get max back.
  pt = ares_timeout(channel_, &tmax, &tinfo);
  EXPECT_EQ(&tmax, pt);
  EXPECT_EQ(0, pt->tv_sec);
  EXPECT_EQ(10, pt->tv_usec);

  pt = ares_timeout(channel_, nullptr, &tinfo);
  EXPECT_EQ(nullptr, pt);

  HostResult result;
  ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result);

  // Now there's a timer running.
  pt = ares_timeout(channel_, &tmax, &tinfo);
  EXPECT_EQ(&tmax, pt);
  EXPECT_EQ(0, pt->tv_sec);
  EXPECT_EQ(10, pt->tv_usec);

  tmax.tv_sec = 100;
  pt = ares_timeout(channel_, &tmax, &tinfo);
  EXPECT_EQ(&tinfo, pt);

  pt = ares_timeout(channel_, nullptr, &tinfo);



( run in 0.985 second using v1.01-cache-2.11-cpan-49f99fa48dc )