build: drop detecting gettimeofday() on Windows

To remove a build difference between mingw-w64 and MSVC builds (where
mingw-w64 has it, while MSVC does not). Also to simplify and save the
cost of detection/verification in CI.

`gettimeofday()` was used in `curl_threads.c` in codepath practically
unreachable in Windows builds, and in `tool_writeout.c` that falls back
to `time()` for targets without it.

Ref: #22593

Closes #22594
This commit is contained in:
Viktor Szakats 2026-08-15 12:56:23 +02:00
parent 5b9946a106
commit 4b42956cd1
No known key found for this signature in database
3 changed files with 2 additions and 4 deletions

View file

@ -28,7 +28,6 @@ endif()
if(MINGW)
set(HAVE_BASENAME 1)
set(HAVE_BOOL_T 1) # = HAVE_STDBOOL_H
set(HAVE_GETTIMEOFDAY 1)
set(HAVE_LIBGEN_H 1)
set(HAVE_STDBOOL_H 1)
set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size()
@ -38,7 +37,6 @@ if(MINGW)
set(HAVE_UNISTD_H 1)
set(HAVE_UTIME_H 1) # wrapper to sys/utime.h
else()
set(HAVE_GETTIMEOFDAY 0)
set(HAVE_LIBGEN_H 0)
set(HAVE_STRINGS_H 0)
set(HAVE_SYS_PARAM_H 0)

View file

@ -1647,7 +1647,6 @@ check_symbol_exists("fcntl" "fcntl.h" HAVE_FCNTL)
check_function_exists("getppid" HAVE_GETPPID)
check_function_exists("utimes" HAVE_UTIMES)
check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # sys/time.h
check_symbol_exists("closesocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET) # winsock2.h
check_symbol_exists("sigsetjmp" "setjmp.h" HAVE_SIGSETJMP)
check_function_exists("getpass_r" HAVE_GETPASS_R)
@ -1688,6 +1687,7 @@ endif()
if(NOT WIN32)
check_include_file("dirent.h" HAVE_DIRENT_H)
check_function_exists("gettimeofday" HAVE_GETTIMEOFDAY) # sys/time.h
check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h
check_function_exists("realpath" HAVE_REALPATH)
check_function_exists("sched_yield" HAVE_SCHED_YIELD)

View file

@ -4226,7 +4226,6 @@ AC_CHECK_FUNCS([\
getpwuid \
getpwuid_r \
getrlimit \
gettimeofday \
mach_absolute_time \
pipe \
poll \
@ -4249,6 +4248,7 @@ fi
if test "$curl_cv_native_windows" != "yes"; then
AC_CHECK_FUNCS([\
gettimeofday \
if_nametoindex \
realpath \
sched_yield \