summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAndres Freund2022-08-06 15:34:56 +0000
committerAndres Freund2022-08-06 15:34:56 +0000
commit922a8fa098404cbd5c6089e78eca4aebd828f847 (patch)
treeef8e0ef81b416a479366eb0fc9d7584dee2f962b /src/include
parent6c1c9f88ad5484fbef201b6adf59c319ceed764e (diff)
Simplify gettimeofday() fallback logic.
There's no known supported system needing 1 argument gettimeofday() support. The test for it was added a long time ago (92c6bf9775b). Remove. Until now we tested whether a gettimeofday() fallback is needed when targetting windows. Which lead to the odd result that HAVE_GETTIMEOFDAY only being defined when targetting MinGW (which has gettimeofday() since at least 2007). As the fallback is specific to msvc, remove the configure code and rename src/port/gettimeofday.c to src/port/win32gettimeofday.c. While at it, also remove the definition of struct timezone, a forward declaration of the struct is sufficient. Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220806000311.ywx65iuchvj4qn2k@awork3.anarazel.de
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pg_config.h.in10
-rw-r--r--src/include/port.h5
-rw-r--r--src/include/port/win32_port.h15
3 files changed, 5 insertions, 25 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index b584788dc08..2d9a1cdc8ab 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -55,13 +55,6 @@
(--enable-thread-safety) */
#undef ENABLE_THREAD_SAFETY
-/* Define to 1 if gettimeofday() takes only 1 argument. */
-#undef GETTIMEOFDAY_1ARG
-
-#ifdef GETTIMEOFDAY_1ARG
-# define gettimeofday(a,b) gettimeofday(a)
-#endif
-
/* Define to 1 if you have the `append_history' function. */
#undef HAVE_APPEND_HISTORY
@@ -215,9 +208,6 @@
/* Define to 1 if you have the `getpeerucred' function. */
#undef HAVE_GETPEERUCRED
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
#undef HAVE_GSSAPI_GSSAPI_H
diff --git a/src/include/port.h b/src/include/port.h
index feb2ae840dd..ad76384fb19 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -327,11 +327,6 @@ extern FILE *pgwin32_popen(const char *command, const char *type);
#define popen(a,b) pgwin32_popen(a,b)
#define pclose(a) _pclose(a)
-/* New versions of MingW have gettimeofday, old mingw and msvc don't */
-#ifndef HAVE_GETTIMEOFDAY
-/* Last parameter not used */
-extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
-#endif
#else /* !WIN32 */
/*
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index a65996cce51..79451a00f96 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -179,16 +179,11 @@
#define SIGUSR1 30
#define SIGUSR2 31
-/*
- * New versions of MinGW have gettimeofday() and also declare
- * struct timezone to support it.
- */
-#ifndef HAVE_GETTIMEOFDAY
-struct timezone
-{
- int tz_minuteswest; /* Minutes west of GMT. */
- int tz_dsttime; /* Nonzero if DST is ever in effect. */
-};
+/* MinW has gettimeofday(), but MSVC doesn't */
+#ifdef _MSC_VER
+struct timezone;
+/* Last parameter not used */
+extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
#endif
/* for setitimer in backend/port/win32/timer.c */