]>
Commit | Line | Data |
---|---|---|
21155a62 AM |
1 | --- perl-5.8.7/reentr.inc.161305 2005-11-03 12:56:58.000000000 -0500 |
2 | +++ perl-5.8.7/reentr.inc 2005-11-03 12:58:16.000000000 -0500 | |
3 | @@ -1368,10 +1368,10 @@ | |
4 | #ifdef HAS_LOCALTIME_R | |
5 | # undef localtime | |
6 | # if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_S_TS | |
7 | -# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0) | |
8 | +# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) ? &PL_reentrant_buffer->_localtime_struct : 0) | |
9 | # endif | |
10 | # if !defined(localtime) && LOCALTIME_R_PROTO == REENTRANT_PROTO_I_TS | |
11 | -# define localtime(a) (localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0) | |
12 | +# define localtime(a) ( L_R_TZSET localtime_r(a, &PL_reentrant_buffer->_localtime_struct) == 0 ? &PL_reentrant_buffer->_localtime_struct : 0) | |
13 | # endif | |
14 | #endif /* HAS_LOCALTIME_R */ | |
15 | ||
16 | --- perl-5.8.7/config_h.SH.161305 2005-04-30 10:34:20.000000000 -0400 | |
17 | +++ perl-5.8.7/config_h.SH 2005-11-03 12:58:16.000000000 -0500 | |
18 | @@ -1916,7 +1916,18 @@ | |
19 | */ | |
20 | #$d_localtime_r HAS_LOCALTIME_R /**/ | |
21 | #define LOCALTIME_R_PROTO $localtime_r_proto /**/ | |
22 | - | |
23 | +/* LOCALTIME_R_NEEDS_TZSET : | |
24 | + * many libc's localtime_r implementations do not call tzset, | |
25 | + * making them differ from localtime(), and making timezone | |
26 | + * changes using $ENV{TZ} without explicitly calling tzset | |
27 | + * impossible. This symbol makes us call tzset before localtime_r: | |
28 | + */ | |
29 | +#$d_localtime_r_needs_tzset LOCALTIME_R_NEEDS_TZSET /**/ | |
30 | +#ifdef LOCALTIME_R_NEEDS_TZSET | |
31 | +#define L_R_TZSET tzset(), | |
32 | +#else | |
33 | +#define L_R_TZSET | |
34 | +#endif | |
35 | /* HAS_LONG_DOUBLE: | |
36 | * This symbol will be defined if the C compiler supports long | |
37 | * doubles. | |
38 | --- perl-5.8.7/Configure.161305 2005-11-03 12:56:58.000000000 -0500 | |
39 | +++ perl-5.8.7/Configure 2005-11-03 13:13:54.000000000 -0500 | |
40 | @@ -528,6 +528,7 @@ | |
41 | d_libm_lib_version='' | |
42 | d_link='' | |
43 | d_localtime_r='' | |
44 | +d_localtime_r_needs_tzset='' | |
45 | localtime_r_proto='' | |
46 | d_locconv='' | |
47 | d_lockf='' | |
48 | @@ -14023,7 +14024,55 @@ | |
49 | *) localtime_r_proto=0 | |
50 | ;; | |
51 | esac | |
52 | +: see if localtime_r calls tzset | |
53 | +case "$localtime_r_proto" in | |
54 | +REENTRANT_PROTO*) | |
55 | + $cat >try.c <<EOCP | |
56 | +/* Does our libc's localtime_r call tzset ? | |
57 | + * return 0 if so, 1 otherwise. | |
58 | + */ | |
59 | +#include <sys/types.h> | |
60 | +#include <unistd.h> | |
61 | +#include <time.h> | |
62 | +#include <string.h> | |
63 | +#include <malloc.h> | |
64 | +int main() | |
65 | +{ | |
66 | + time_t t = time(0L); | |
67 | + char w_tz[]="TZ=GMT+5", | |
68 | + e_tz[]="TZ=GMT-5", | |
69 | + *tz_e = (char*)malloc(16), | |
70 | + *tz_w = (char*)malloc(16); | |
71 | + struct tm tm_e, tm_w; | |
72 | + | |
73 | + strcpy(tz_e,e_tz); | |
74 | + strcpy(tz_w,w_tz); | |
75 | + | |
76 | + putenv(tz_e); | |
77 | + localtime_r(&t, &tm_e); | |
78 | + | |
79 | + putenv(tz_w); | |
80 | + localtime_r(&t, &tm_w); | |
81 | ||
82 | + if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 ) | |
83 | + return 1; | |
84 | + return 0; | |
85 | +} | |
86 | +EOCP | |
87 | + set try | |
88 | + if eval $compile; then | |
89 | + if ./try; then | |
90 | + d_localtime_r_needs_tzset=undef; | |
91 | + else | |
92 | + d_localtime_r_needs_tzset=define; | |
93 | + fi; | |
94 | + rm -f ./try; | |
95 | + else | |
96 | + d_localtime_r_needs_tzset=undef; | |
97 | + fi; | |
98 | + rm -f try.c; | |
99 | + ;; | |
100 | +esac | |
101 | : see if localeconv exists | |
102 | set localeconv d_locconv | |
103 | eval $inlibc | |
104 | @@ -20769,6 +20818,7 @@ | |
105 | d_libm_lib_version='$d_libm_lib_version' | |
106 | d_link='$d_link' | |
107 | d_localtime_r='$d_localtime_r' | |
108 | +d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset' | |
109 | d_locconv='$d_locconv' | |
110 | d_lockf='$d_lockf' | |
111 | d_longdbl='$d_longdbl' |