summaryrefslogtreecommitdiff
path: root/src/include/portability/instr_time.h
diff options
context:
space:
mode:
authorThomas Munro2022-08-05 03:56:36 +0000
committerThomas Munro2022-08-05 04:37:11 +0000
commit623cc67347cc62eb676570c81abe5e1f63ecaa1e (patch)
tree8182f8e5940606c75529b3905602d46174b78804 /src/include/portability/instr_time.h
parent92f375056c11193c26f1278446e6301f0c18ea22 (diff)
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 <[email protected]> Reviewed-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
Diffstat (limited to 'src/include/portability/instr_time.h')
-rw-r--r--src/include/portability/instr_time.h68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h
index ca09a1608f8..8faeca8b49e 100644
--- a/src/include/portability/instr_time.h
+++ b/src/include/portability/instr_time.h
@@ -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() */