Remove configure probe for clock_gettime.
authorThomas Munro <tmunro@postgresql.org>
Fri, 5 Aug 2022 03:56:36 +0000 (15:56 +1200)
committerThomas Munro <tmunro@postgresql.org>
Fri, 5 Aug 2022 04:37:11 +0000 (16:37 +1200)
clock_gettime() is in SUSv2 and all targeted Unix systems have it.
Remove a chunk of fallback code for old Unix is no longer reachable on
modern systems, and untested as of the retirement of build farm animal
prairiedog.

There is no need to retain a HAVE_CLOCK_GETTIME macro here, because it
is already used in a context with Unix and Windows code paths.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com

configure
configure.ac
src/include/pg_config.h.in
src/include/portability/instr_time.h
src/tools/msvc/Solution.pm

index b7a77033586a73a21b141ac012ee2ba5845c8886..21f4520f8107b3ca8fa48db440f59b71e4bb8f59 100755 (executable)
--- a/configure
+++ b/configure
@@ -16039,7 +16039,7 @@ fi
 LIBS_including_readline="$LIBS"
 LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
 
-for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
+for ac_func in backtrace_symbols copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 2938c9c7de70eb3d08f6a0fc84e57da8f6caaab7..a7ab66017909168e0d3b01fa867fd505f3cfcf86 100644 (file)
@@ -1791,7 +1791,6 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
 
 AC_CHECK_FUNCS(m4_normalize([
    backtrace_symbols
-   clock_gettime
    copyfile
    fdatasync
    getifaddrs
index dfee47a1a45ebe73a04b2664bbc1ac832aadedc2..6505a842118f13c89f5f4b178889a38f4bf303a3 100644 (file)
@@ -83,9 +83,6 @@
 /* Define to 1 if you have the `BIO_meth_new' function. */
 #undef HAVE_BIO_METH_NEW
 
-/* Define to 1 if you have the `clock_gettime' function. */
-#undef HAVE_CLOCK_GETTIME
-
 /* Define to 1 if your compiler handles computed gotos. */
 #undef HAVE_COMPUTED_GOTO
 
index ca09a1608f8370f2b80d09c8395968117a52721e..8faeca8b49ed80cdf7b146b6ffc173865793ec9f 100644 (file)
@@ -57,8 +57,6 @@
 
 #ifndef WIN32
 
-#ifdef HAVE_CLOCK_GETTIME
-
 /* Use clock_gettime() */
 
 #include <time.h>
@@ -141,72 +139,6 @@ typedef struct timespec instr_time;
 #define INSTR_TIME_GET_MICROSEC(t) \
    (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) ((t).tv_nsec / 1000))
 
-#else                          /* !HAVE_CLOCK_GETTIME */
-
-/* Use gettimeofday() */
-
-#include <sys/time.h>
-
-typedef struct timeval instr_time;
-
-#define INSTR_TIME_IS_ZERO(t)  ((t).tv_usec == 0 && (t).tv_sec == 0)
-
-#define INSTR_TIME_SET_ZERO(t) ((t).tv_sec = 0, (t).tv_usec = 0)
-
-#define INSTR_TIME_SET_CURRENT(t)  gettimeofday(&(t), NULL)
-
-#define INSTR_TIME_ADD(x,y) \
-   do { \
-       (x).tv_sec += (y).tv_sec; \
-       (x).tv_usec += (y).tv_usec; \
-       /* Normalize */ \
-       while ((x).tv_usec >= 1000000) \
-       { \
-           (x).tv_usec -= 1000000; \
-           (x).tv_sec++; \
-       } \
-   } while (0)
-
-#define INSTR_TIME_SUBTRACT(x,y) \
-   do { \
-       (x).tv_sec -= (y).tv_sec; \
-       (x).tv_usec -= (y).tv_usec; \
-       /* Normalize */ \
-       while ((x).tv_usec < 0) \
-       { \
-           (x).tv_usec += 1000000; \
-           (x).tv_sec--; \
-       } \
-   } while (0)
-
-#define INSTR_TIME_ACCUM_DIFF(x,y,z) \
-   do { \
-       (x).tv_sec += (y).tv_sec - (z).tv_sec; \
-       (x).tv_usec += (y).tv_usec - (z).tv_usec; \
-       /* Normalize after each add to avoid overflow/underflow of tv_usec */ \
-       while ((x).tv_usec < 0) \
-       { \
-           (x).tv_usec += 1000000; \
-           (x).tv_sec--; \
-       } \
-       while ((x).tv_usec >= 1000000) \
-       { \
-           (x).tv_usec -= 1000000; \
-           (x).tv_sec++; \
-       } \
-   } while (0)
-
-#define INSTR_TIME_GET_DOUBLE(t) \
-   (((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0)
-
-#define INSTR_TIME_GET_MILLISEC(t) \
-   (((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0)
-
-#define INSTR_TIME_GET_MICROSEC(t) \
-   (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec)
-
-#endif                         /* HAVE_CLOCK_GETTIME */
-
 #else                          /* WIN32 */
 
 /* Use QueryPerformanceCounter() */
index dd9d1a58ad60bb54231a538894770eb9526a9534..bd8b755b9647997545c01749f1e3d5fbd01b37e1 100644 (file)
@@ -228,7 +228,6 @@ sub GenerateFiles
        HAVE_BACKTRACE_SYMBOLS     => undef,
        HAVE_BIO_GET_DATA          => undef,
        HAVE_BIO_METH_NEW          => undef,
-       HAVE_CLOCK_GETTIME         => undef,
        HAVE_COMPUTED_GOTO         => undef,
        HAVE_COPYFILE              => undef,
        HAVE_COPYFILE_H            => undef,