Skip to content

Commit a8c3e22

Browse files
committed
Replace PHP_TM_GMTOFF with AC_CHECK_MEMBERS
Changes: - PHP_TM_GMTOFF removed - HAVE_TM_GMTOFF replaced with HAVE_STRUCT_TM_TM_GMTOFF - HAVE_TM_ZONE replaced with HAVE_STRUCT_TM_TM_ZONE - HAVE_TZNAME removed The PHP_TM_GMTOFF macro can be replaced with Autoconf's AC_CHECK_MEMBERS that defines the HAVE_STRUCT_TM_TM_GMTOFF symbol instead of the HAVE_TM_ZONE. The HAVE_TZNAME symbol is not used in current code. The obsolete HAVE_TM_ZONE symbol has been replaced with more proper HAVE_STRUCT_TM_TM_ZONE. These are defined by the AC_STRUCT_TIMEZONE macro.
1 parent 1c32d75 commit a8c3e22

File tree

7 files changed

+13
-29
lines changed

7 files changed

+13
-29
lines changed

acinclude.m4

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,20 +1337,6 @@ int readdir_r(DIR *, struct dirent *);
13371337
fi
13381338
])
13391339

1340-
dnl
1341-
dnl PHP_TM_GMTOFF
1342-
dnl
1343-
AC_DEFUN([PHP_TM_GMTOFF],[
1344-
AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
1345-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1346-
#include <time.h>]], [[struct tm tm; tm.tm_gmtoff;]])],
1347-
[ac_cv_struct_tm_gmtoff=yes], [ac_cv_struct_tm_gmtoff=no])])
1348-
1349-
if test "$ac_cv_struct_tm_gmtoff" = yes; then
1350-
AC_DEFINE(HAVE_TM_GMTOFF,1,[whether you have tm_gmtoff in struct tm])
1351-
fi
1352-
])
1353-
13541340
dnl
13551341
dnl PHP_STRUCT_FLOCK
13561342
dnl

configure.ac

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,6 @@ AC_STRUCT_TIMEZONE
501501

502502
PHP_MISSING_TIME_R_DECL
503503
PHP_MISSING_FCLOSE_DECL
504-
505-
PHP_TM_GMTOFF
506504
PHP_STRUCT_FLOCK
507505
PHP_SOCKLEN_T
508506

@@ -551,7 +549,8 @@ PHP_CHECK_CPU_SUPPORTS([sse4.2])
551549
PHP_CHECK_CPU_SUPPORTS([avx])
552550
PHP_CHECK_CPU_SUPPORTS([avx2])
553551

554-
dnl Check for members of the stat structure
552+
dnl Check for structure members
553+
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
555554
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
556555
dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exist
557556
dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument

ext/date/php_date.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,20 +1682,20 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
16821682
ta.tm_yday = timelib_day_of_year(ts->y, ts->m, ts->d);
16831683
if (gmt) {
16841684
ta.tm_isdst = 0;
1685-
#if HAVE_TM_GMTOFF
1685+
#if HAVE_STRUCT_TM_TM_GMTOFF
16861686
ta.tm_gmtoff = 0;
16871687
#endif
1688-
#if HAVE_TM_ZONE
1688+
#if HAVE_STRUCT_TM_TM_ZONE
16891689
ta.tm_zone = "GMT";
16901690
#endif
16911691
} else {
16921692
offset = timelib_get_time_zone_info(timestamp, tzi);
16931693

16941694
ta.tm_isdst = offset->is_dst;
1695-
#if HAVE_TM_GMTOFF
1695+
#if HAVE_STRUCT_TM_TM_GMTOFF
16961696
ta.tm_gmtoff = offset->offset;
16971697
#endif
1698-
#if HAVE_TM_ZONE
1698+
#if HAVE_STRUCT_TM_TM_ZONE
16991699
ta.tm_zone = offset->abbr;
17001700
#endif
17011701
}

ext/interbase/ibase_query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{
13901390
always sets tm_isdst to 0, sometimes incorrectly (InterBase 6 bug?)
13911391
*/
13921392
t.tm_isdst = -1;
1393-
#if HAVE_TM_ZONE
1393+
#if HAVE_STRUCT_TM_TM_ZONE
13941394
t.tm_zone = tzname[0];
13951395
#endif
13961396
if (flag & PHP_IBASE_UNIXTIME) {

ext/openssl/openssl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ static time_t php_openssl_asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */
10221022
thetime.tm_isdst = -1;
10231023
ret = mktime(&thetime);
10241024

1025-
#if HAVE_TM_GMTOFF
1025+
#if HAVE_STRUCT_TM_TM_GMTOFF
10261026
gmadjust = thetime.tm_gmtoff;
10271027
#else
10281028
/*
@@ -2265,10 +2265,10 @@ PHP_FUNCTION(openssl_x509_verify)
22652265
if (key == NULL) {
22662266
X509_free(cert);
22672267
RETURN_LONG(err);
2268-
}
2269-
2268+
}
2269+
22702270
err = X509_verify(cert, key);
2271-
2271+
22722272
if (err < 0) {
22732273
php_openssl_store_errors();
22742274
}
@@ -2279,7 +2279,7 @@ PHP_FUNCTION(openssl_x509_verify)
22792279
if (Z_TYPE_P(zcert) != IS_RESOURCE) {
22802280
X509_free(cert);
22812281
}
2282-
2282+
22832283
RETURN_LONG(err);
22842284
}
22852285
/* }}} */

ext/soap/php_encoding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
28572857
}
28582858

28592859
/* Time zone support */
2860-
#ifdef HAVE_TM_GMTOFF
2860+
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
28612861
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
28622862
#else
28632863
# if defined(__CYGWIN__) || (defined(PHP_WIN32) && defined(_MSC_VER) && _MSC_VER >= 1900)

win32/build/config.w32.h.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#define HAVE_PUTENV 1
6262
#define HAVE_LIMITS_H 1
6363
#define HAVE_TZSET 1
64-
#define HAVE_TZNAME 1
6564
#undef HAVE_FLOCK
6665
#define HAVE_ALLOCA 1
6766
#undef HAVE_SYS_TIME_H

0 commit comments

Comments
 (0)