Skip to content

Commit f1c1903

Browse files
benjaminpYhg1s
authored andcommitted
bpo-38068: Clean up gettimeofday configure logic. (GH-15775)
Assume gettimeofday exists and takes two arguments.
1 parent c8dfa73 commit f1c1903

File tree

5 files changed

+1
-59
lines changed

5 files changed

+1
-59
lines changed

Python/pytime.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,7 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
718718
#else /* HAVE_CLOCK_GETTIME */
719719

720720
/* test gettimeofday() */
721-
#ifdef GETTIMEOFDAY_NO_TZ
722-
err = gettimeofday(&tv);
723-
#else
724721
err = gettimeofday(&tv, (struct timezone *)NULL);
725-
#endif
726722
if (err) {
727723
if (raise) {
728724
PyErr_SetFromErrno(PyExc_OSError);

Python/thread_pthread.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,10 @@
9797
#endif
9898

9999

100-
/* We assume all modern POSIX systems have gettimeofday() */
101-
#ifdef GETTIMEOFDAY_NO_TZ
102-
#define GETTIMEOFDAY(ptv) gettimeofday(ptv)
103-
#else
104-
#define GETTIMEOFDAY(ptv) gettimeofday(ptv, (struct timezone *)NULL)
105-
#endif
106-
107100
#define MICROSECONDS_TO_TIMESPEC(microseconds, ts) \
108101
do { \
109102
struct timeval tv; \
110-
GETTIMEOFDAY(&tv); \
103+
gettimeofday(&tv, NULL); \
111104
tv.tv_usec += microseconds % 1000000; \
112105
tv.tv_sec += microseconds / 1000000; \
113106
tv.tv_sec += tv.tv_usec / 1000000; \

configure

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12735,37 +12735,6 @@ if ac_fn_c_try_compile "$LINENO"; then :
1273512735

1273612736
$as_echo "#define SETPGRP_HAVE_ARG 1" >>confdefs.h
1273712737

12738-
fi
12739-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12740-
12741-
fi
12742-
done
12743-
12744-
for ac_func in gettimeofday
12745-
do :
12746-
ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
12747-
if test "x$ac_cv_func_gettimeofday" = xyes; then :
12748-
cat >>confdefs.h <<_ACEOF
12749-
#define HAVE_GETTIMEOFDAY 1
12750-
_ACEOF
12751-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12752-
/* end confdefs.h. */
12753-
#include <sys/time.h>
12754-
int
12755-
main ()
12756-
{
12757-
gettimeofday((struct timeval*)0,(struct timezone*)0);
12758-
;
12759-
return 0;
12760-
}
12761-
_ACEOF
12762-
if ac_fn_c_try_compile "$LINENO"; then :
12763-
12764-
else
12765-
12766-
$as_echo "#define GETTIMEOFDAY_NO_TZ 1" >>confdefs.h
12767-
12768-
1276912738
fi
1277012739
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1277112740

configure.ac

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,15 +3865,6 @@ AC_CHECK_FUNCS(setpgrp,
38653865
[AC_DEFINE(SETPGRP_HAVE_ARG, 1, [Define if setpgrp() must be called as setpgrp(0, 0).])],
38663866
[])
38673867
)
3868-
AC_CHECK_FUNCS(gettimeofday,
3869-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>]],
3870-
[[gettimeofday((struct timeval*)0,(struct timezone*)0);]])],
3871-
[],
3872-
[AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
3873-
[Define if gettimeofday() does not have second (timezone) argument
3874-
This is the case on Motorola V4 (R40V4.2)])
3875-
])
3876-
)
38773868

38783869
# We search for both crypt and crypt_r as one or the other may be defined
38793870
# This gets us our -lcrypt in LIBS when required on the target platform.

pyconfig.h.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
/* Define if getpgrp() must be called as getpgrp(0). */
4545
#undef GETPGRP_HAVE_ARG
4646

47-
/* Define if gettimeofday() does not have second (timezone) argument This is
48-
the case on Motorola V4 (R40V4.2) */
49-
#undef GETTIMEOFDAY_NO_TZ
50-
5147
/* Define to 1 if you have the `accept4' function. */
5248
#undef HAVE_ACCEPT4
5349

@@ -510,9 +506,6 @@
510506
/* Define to 1 if you have the `getspnam' function. */
511507
#undef HAVE_GETSPNAM
512508

513-
/* Define to 1 if you have the `gettimeofday' function. */
514-
#undef HAVE_GETTIMEOFDAY
515-
516509
/* Define to 1 if you have the `getwd' function. */
517510
#undef HAVE_GETWD
518511

0 commit comments

Comments
 (0)