Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1836781

Browse files
committed
Improve detection of whether tzset is broken.
1 parent a425dbc commit 1836781

3 files changed

Lines changed: 56 additions & 15 deletions

File tree

configure

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.430 .
2+
# From configure.in Revision: 1.431 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.57 for python 2.4.
55
#
@@ -18254,20 +18254,39 @@ cat >>conftest.$ac_ext <<_ACEOF
1825418254

1825518255
#include <stdlib.h>
1825618256
#include <time.h>
18257+
#include <string.h>
1825718258
int main()
1825818259
{
18259-
int gmt_hour;
18260-
int eastern_hour;
18261-
time_t now;
18262-
now = time((time_t*)NULL);
18260+
/* Note that we need to ensure that not only does tzset(3)
18261+
do 'something' with localtime, but it works as documented
18262+
in the library reference and as expected by the test suite.
18263+
18264+
Red Hat 6.2 doesn't understand the southern hemisphere
18265+
after New Year's Day; it thinks swaps on that day.
18266+
*/
18267+
18268+
time_t groundhogday = 1044144000; /* GMT-based; well, it's a colony */
18269+
time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
18270+
1826318271
putenv("TZ=UTC+0");
1826418272
tzset();
18265-
gmt_hour = localtime(&now)->tm_hour;
18273+
if (localtime(&groundhogday)->tm_hour != 0)
18274+
exit(1);
18275+
1826618276
putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
1826718277
tzset();
18268-
eastern_hour = localtime(&now)->tm_hour;
18269-
if (eastern_hour == gmt_hour)
18278+
if (localtime(&groundhogday)->tm_hour != 19)
1827018279
exit(1);
18280+
18281+
putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
18282+
tzset();
18283+
if (localtime(&groundhogday)->tm_hour != 11)
18284+
exit(1);
18285+
if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
18286+
exit(1);
18287+
if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
18288+
exit(1);
18289+
1827118290
exit(0);
1827218291
}
1827318292

configure.in

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,20 +2810,39 @@ AC_CACHE_VAL(ac_cv_working_tzset, [
28102810
AC_TRY_RUN([
28112811
#include <stdlib.h>
28122812
#include <time.h>
2813+
#include <string.h>
28132814
int main()
28142815
{
2815-
int gmt_hour;
2816-
int eastern_hour;
2817-
time_t now;
2818-
now = time((time_t*)NULL);
2816+
/* Note that we need to ensure that not only does tzset(3)
2817+
do 'something' with localtime, but it works as documented
2818+
in the library reference and as expected by the test suite.
2819+
2820+
Red Hat 6.2 doesn't understand the southern hemisphere
2821+
after New Year's Day; it thinks swaps on that day.
2822+
*/
2823+
2824+
time_t groundhogday = 1044144000; /* GMT-based; well, it's a colony */
2825+
time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
2826+
28192827
putenv("TZ=UTC+0");
28202828
tzset();
2821-
gmt_hour = localtime(&now)->tm_hour;
2829+
if (localtime(&groundhogday)->tm_hour != 0)
2830+
exit(1);
2831+
28222832
putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
28232833
tzset();
2824-
eastern_hour = localtime(&now)->tm_hour;
2825-
if (eastern_hour == gmt_hour)
2834+
if (localtime(&groundhogday)->tm_hour != 19)
28262835
exit(1);
2836+
2837+
putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
2838+
tzset();
2839+
if (localtime(&groundhogday)->tm_hour != 11)
2840+
exit(1);
2841+
if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
2842+
exit(1);
2843+
if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
2844+
exit(1);
2845+
28272846
exit(0);
28282847
}
28292848
],

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@
600600
`tzname'. */
601601
#undef HAVE_TZNAME
602602

603+
/* Define this if you have tcl and TCL_UTF_MAX==6 */
604+
#undef HAVE_UCS4_TCL
605+
603606
/* Define this if you have the type uintptr_t. */
604607
#undef HAVE_UINTPTR_T
605608

0 commit comments

Comments
 (0)