]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Improve detection of broken implementations of tzset().
authorBrett Cannon <bcannon@gmail.com>
Fri, 19 Sep 2003 01:00:16 +0000 (01:00 +0000)
committerBrett Cannon <bcannon@gmail.com>
Fri, 19 Sep 2003 01:00:16 +0000 (01:00 +0000)
configure
configure.in
pyconfig.h.in

index 20e138cdbcd1170bbd14b773e70c547a693503e2..4e714324051b6c097a640cc2660844bec52a44fc 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.427.4.1 .
+# From configure.in Revision: 1.427.4.2 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57 for python 2.3.
 #
@@ -18242,20 +18242,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.
+
+          Linux 6.2 doesn't understand the southern hemisphere
+          after New Year's 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);
 }
 
index 7c4918d0f968c00fdfcd2d0315bebbc8fbf4592f..03d89d5f102ea374b853dc817c81ae41872d3bf5 100644 (file)
@@ -2798,20 +2798,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.
+
+          Linux 6.2 doesn't understand the southern hemisphere 
+          after New Year's 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);
 }
 ],
index dacd3042a2b664e90ed2ee979b4779a271bbc716..9df836f937d923eb7d6ea2410cdcd07b0e4f7a9d 100644 (file)
    `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