Loading CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,7 @@ check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT) check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL) check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL) check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT) check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME) # symbol exists in win32, but function does not. if(WIN32) Loading configure.ac +1 −0 Original line number Diff line number Diff line Loading @@ -3385,6 +3385,7 @@ AC_CHECK_FUNCS([geteuid \ getrlimit \ gettimeofday \ if_nametoindex \ mach_absolute_time \ pipe \ setlocale \ setmode \ Loading lib/curl_config.h.cmake +3 −0 Original line number Diff line number Diff line Loading @@ -1000,3 +1000,6 @@ /* the signed version of size_t */ #cmakedefine ssize_t ${ssize_t} /* Define to 1 if you have the mach_absolute_time function. */ #cmakedefine HAVE_MACH_ABSOLUTE_TIME 1 lib/timeval.c +31 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,37 @@ struct curltime Curl_now(void) return cnow; } #elif defined(HAVE_MACH_ABSOLUTE_TIME) #include <stdint.h> #include <mach/mach_time.h> struct curltime Curl_now(void) { /* ** Monotonic timer on Mac OS is provided by mach_absolute_time(), which ** returns time in Mach "absolute time units," which are platform-dependent. ** To convert to nanoseconds, one must use conversion factors specified by ** mach_timebase_info(). */ static mach_timebase_info_data_t timebase; struct curltime cnow; uint64_t usecs; if(0 == timebase.denom) (void) mach_timebase_info(&timebase); usecs = mach_absolute_time(); usecs *= timebase.numer; usecs /= timebase.denom; usecs /= 1000; cnow.tv_sec = usecs / 1000000; cnow.tv_usec = usecs % 1000000; return cnow; } #elif defined(HAVE_GETTIMEOFDAY) struct curltime Curl_now(void) Loading Loading
CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,7 @@ check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT) check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL) check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL) check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT) check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME) # symbol exists in win32, but function does not. if(WIN32) Loading
configure.ac +1 −0 Original line number Diff line number Diff line Loading @@ -3385,6 +3385,7 @@ AC_CHECK_FUNCS([geteuid \ getrlimit \ gettimeofday \ if_nametoindex \ mach_absolute_time \ pipe \ setlocale \ setmode \ Loading
lib/curl_config.h.cmake +3 −0 Original line number Diff line number Diff line Loading @@ -1000,3 +1000,6 @@ /* the signed version of size_t */ #cmakedefine ssize_t ${ssize_t} /* Define to 1 if you have the mach_absolute_time function. */ #cmakedefine HAVE_MACH_ABSOLUTE_TIME 1
lib/timeval.c +31 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,37 @@ struct curltime Curl_now(void) return cnow; } #elif defined(HAVE_MACH_ABSOLUTE_TIME) #include <stdint.h> #include <mach/mach_time.h> struct curltime Curl_now(void) { /* ** Monotonic timer on Mac OS is provided by mach_absolute_time(), which ** returns time in Mach "absolute time units," which are platform-dependent. ** To convert to nanoseconds, one must use conversion factors specified by ** mach_timebase_info(). */ static mach_timebase_info_data_t timebase; struct curltime cnow; uint64_t usecs; if(0 == timebase.denom) (void) mach_timebase_info(&timebase); usecs = mach_absolute_time(); usecs *= timebase.numer; usecs /= timebase.denom; usecs /= 1000; cnow.tv_sec = usecs / 1000000; cnow.tv_usec = usecs % 1000000; return cnow; } #elif defined(HAVE_GETTIMEOFDAY) struct curltime Curl_now(void) Loading