Skip to content

Commit 623cc67

Browse files
committed
Remove configure probe for clock_gettime.
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
1 parent 92f3750 commit 623cc67

File tree

5 files changed

+1
-74
lines changed

5 files changed

+1
-74
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16039,7 +16039,7 @@ fi
1603916039
LIBS_including_readline="$LIBS"
1604016040
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
1604116041

16042-
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
16042+
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
1604316043
do :
1604416044
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1604516045
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,6 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
17911791

17921792
AC_CHECK_FUNCS(m4_normalize([
17931793
backtrace_symbols
1794-
clock_gettime
17951794
copyfile
17961795
fdatasync
17971796
getifaddrs

src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@
8383
/* Define to 1 if you have the `BIO_meth_new' function. */
8484
#undef HAVE_BIO_METH_NEW
8585

86-
/* Define to 1 if you have the `clock_gettime' function. */
87-
#undef HAVE_CLOCK_GETTIME
88-
8986
/* Define to 1 if your compiler handles computed gotos. */
9087
#undef HAVE_COMPUTED_GOTO
9188

src/include/portability/instr_time.h

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@
5757

5858
#ifndef WIN32
5959

60-
#ifdef HAVE_CLOCK_GETTIME
61-
6260
/* Use clock_gettime() */
6361

6462
#include <time.h>
@@ -141,72 +139,6 @@ typedef struct timespec instr_time;
141139
#define INSTR_TIME_GET_MICROSEC(t) \
142140
(((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) ((t).tv_nsec / 1000))
143141

144-
#else /* !HAVE_CLOCK_GETTIME */
145-
146-
/* Use gettimeofday() */
147-
148-
#include <sys/time.h>
149-
150-
typedef struct timeval instr_time;
151-
152-
#define INSTR_TIME_IS_ZERO(t) ((t).tv_usec == 0 && (t).tv_sec == 0)
153-
154-
#define INSTR_TIME_SET_ZERO(t) ((t).tv_sec = 0, (t).tv_usec = 0)
155-
156-
#define INSTR_TIME_SET_CURRENT(t) gettimeofday(&(t), NULL)
157-
158-
#define INSTR_TIME_ADD(x,y) \
159-
do { \
160-
(x).tv_sec += (y).tv_sec; \
161-
(x).tv_usec += (y).tv_usec; \
162-
/* Normalize */ \
163-
while ((x).tv_usec >= 1000000) \
164-
{ \
165-
(x).tv_usec -= 1000000; \
166-
(x).tv_sec++; \
167-
} \
168-
} while (0)
169-
170-
#define INSTR_TIME_SUBTRACT(x,y) \
171-
do { \
172-
(x).tv_sec -= (y).tv_sec; \
173-
(x).tv_usec -= (y).tv_usec; \
174-
/* Normalize */ \
175-
while ((x).tv_usec < 0) \
176-
{ \
177-
(x).tv_usec += 1000000; \
178-
(x).tv_sec--; \
179-
} \
180-
} while (0)
181-
182-
#define INSTR_TIME_ACCUM_DIFF(x,y,z) \
183-
do { \
184-
(x).tv_sec += (y).tv_sec - (z).tv_sec; \
185-
(x).tv_usec += (y).tv_usec - (z).tv_usec; \
186-
/* Normalize after each add to avoid overflow/underflow of tv_usec */ \
187-
while ((x).tv_usec < 0) \
188-
{ \
189-
(x).tv_usec += 1000000; \
190-
(x).tv_sec--; \
191-
} \
192-
while ((x).tv_usec >= 1000000) \
193-
{ \
194-
(x).tv_usec -= 1000000; \
195-
(x).tv_sec++; \
196-
} \
197-
} while (0)
198-
199-
#define INSTR_TIME_GET_DOUBLE(t) \
200-
(((double) (t).tv_sec) + ((double) (t).tv_usec) / 1000000.0)
201-
202-
#define INSTR_TIME_GET_MILLISEC(t) \
203-
(((double) (t).tv_sec * 1000.0) + ((double) (t).tv_usec) / 1000.0)
204-
205-
#define INSTR_TIME_GET_MICROSEC(t) \
206-
(((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec)
207-
208-
#endif /* HAVE_CLOCK_GETTIME */
209-
210142
#else /* WIN32 */
211143

212144
/* Use QueryPerformanceCounter() */

src/tools/msvc/Solution.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ sub GenerateFiles
228228
HAVE_BACKTRACE_SYMBOLS => undef,
229229
HAVE_BIO_GET_DATA => undef,
230230
HAVE_BIO_METH_NEW => undef,
231-
HAVE_CLOCK_GETTIME => undef,
232231
HAVE_COMPUTED_GOTO => undef,
233232
HAVE_COPYFILE => undef,
234233
HAVE_COPYFILE_H => undef,

0 commit comments

Comments
 (0)