diff options
author | Brett Cannon <bcannon@gmail.com> | 2003-09-19 00:59:16 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2003-09-19 00:59:16 (GMT) |
commit | 1836781faee7628f9ebb2427470f3b34042dd4f8 (patch) | |
tree | f25043f6705fb9900574585c378afc29c23cf710 | |
parent | a425dbc7ce89b290b94a2e622cf1b3e269d5aba1 (diff) | |
download | cpython-1836781faee7628f9ebb2427470f3b34042dd4f8.zip cpython-1836781faee7628f9ebb2427470f3b34042dd4f8.tar.gz cpython-1836781faee7628f9ebb2427470f3b34042dd4f8.tar.bz2 |
Improve detection of whether tzset is broken.
-rwxr-xr-x | configure | 35 | ||||
-rw-r--r-- | configure.in | 33 | ||||
-rw-r--r-- | pyconfig.h.in | 3 |
3 files changed, 56 insertions, 15 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.430 . +# From configure.in Revision: 1.431 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. # @@ -18254,20 +18254,39 @@ cat >>conftest.$ac_ext <<_ACEOF #include <stdlib.h> #include <time.h> +#include <string.h> int main() { - int gmt_hour; - int eastern_hour; - time_t now; - now = time((time_t*)NULL); + /* Note that we need to ensure that not only does tzset(3) + do 'something' with localtime, but it works as documented + in the library reference and as expected by the test suite. + + Red Hat 6.2 doesn't understand the southern hemisphere + after New Year's Day; it thinks swaps on that day. + */ + + time_t groundhogday = 1044144000; /* GMT-based; well, it's a colony */ + time_t midyear = groundhogday + (365 * 24 * 3600 / 2); + putenv("TZ=UTC+0"); tzset(); - gmt_hour = localtime(&now)->tm_hour; + if (localtime(&groundhogday)->tm_hour != 0) + exit(1); + putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); tzset(); - eastern_hour = localtime(&now)->tm_hour; - if (eastern_hour == gmt_hour) + if (localtime(&groundhogday)->tm_hour != 19) exit(1); + + putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); + tzset(); + if (localtime(&groundhogday)->tm_hour != 11) + exit(1); + if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) + exit(1); + if (strcmp(localtime(&midyear)->tm_zone, "AEST")) + exit(1); + exit(0); } diff --git a/configure.in b/configure.in index 70e1ff9..78ccfe1 100644 --- a/configure.in +++ b/configure.in @@ -2810,20 +2810,39 @@ AC_CACHE_VAL(ac_cv_working_tzset, [ AC_TRY_RUN([ #include <stdlib.h> #include <time.h> +#include <string.h> int main() { - int gmt_hour; - int eastern_hour; - time_t now; - now = time((time_t*)NULL); + /* Note that we need to ensure that not only does tzset(3) + do 'something' with localtime, but it works as documented + in the library reference and as expected by the test suite. + + Red Hat 6.2 doesn't understand the southern hemisphere + after New Year's Day; it thinks swaps on that day. + */ + + time_t groundhogday = 1044144000; /* GMT-based; well, it's a colony */ + time_t midyear = groundhogday + (365 * 24 * 3600 / 2); + putenv("TZ=UTC+0"); tzset(); - gmt_hour = localtime(&now)->tm_hour; + if (localtime(&groundhogday)->tm_hour != 0) + exit(1); + putenv("TZ=EST+5EDT,M4.1.0,M10.5.0"); tzset(); - eastern_hour = localtime(&now)->tm_hour; - if (eastern_hour == gmt_hour) + if (localtime(&groundhogday)->tm_hour != 19) exit(1); + + putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0"); + tzset(); + if (localtime(&groundhogday)->tm_hour != 11) + exit(1); + if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT")) + exit(1); + if (strcmp(localtime(&midyear)->tm_zone, "AEST")) + exit(1); + exit(0); } ], diff --git a/pyconfig.h.in b/pyconfig.h.in index dacd304..9df836f 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -600,6 +600,9 @@ `tzname'. */ #undef HAVE_TZNAME +/* Define this if you have tcl and TCL_UTF_MAX==6 */ +#undef HAVE_UCS4_TCL + /* Define this if you have the type uintptr_t. */ #undef HAVE_UINTPTR_T |