52
52
53
53
#if WIN32||WINNT
54
54
# include < time.h>
55
- # include " php.h"
56
- # undef YYSTYPE
57
55
# include " php_reentrancy.h"
58
56
#else
59
57
# if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE)
@@ -62,8 +60,6 @@ extern time_t timezone;
62
60
#endif
63
61
64
62
65
-
66
-
67
63
#define yylhs date_yylhs
68
64
#define yylen date_yylen
69
65
#define yydefred date_yydefred
@@ -157,10 +153,6 @@ static time_t yyRelMonth;
157
153
static time_t yyRelSeconds;
158
154
159
155
160
- extern struct tm *localtime (const time_t *timep);
161
-
162
- /* YYSTYPE is not yet defined at this point */
163
- static int date_lex (void *yylval);
164
156
165
157
static void date_error (char *s);
166
158
@@ -174,6 +166,10 @@ static void date_error(char *s);
174
166
enum _MERIDIAN Meridian;
175
167
}
176
168
169
+ %{
170
+ static int date_lex (YYSTYPE *yylval);
171
+ %}
172
+
177
173
%token tDAY tDAYZONE tMERIDIAN tMONTH tMONTH_UNIT tSEC_UNIT tSNUMBER
178
174
%token tUNUMBER tZONE
179
175
@@ -642,6 +638,7 @@ Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, tim
642
638
time_t Julian;
643
639
int i;
644
640
time_t tod;
641
+ struct tm tmbuf;
645
642
646
643
/* Year should not be passed as a relative value, but absolute one.
647
644
so this should not happen, but just ensure it */
@@ -674,7 +671,7 @@ Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, tim
674
671
return -1 ;
675
672
Julian += tod;
676
673
tod = Julian;
677
- if (dst == DSTon || (dst == DSTmaybe && localtime (&tod)->tm_isdst ))
674
+ if (dst == DSTon || (dst == DSTmaybe && localtime_r (&tod,&tmbuf )->tm_isdst ))
678
675
Julian -= DST_OFFSET * 60 * 60 ;
679
676
return Julian;
680
677
}
@@ -685,9 +682,10 @@ DSTcorrect(time_t Start, time_t Future)
685
682
{
686
683
time_t StartDay;
687
684
time_t FutureDay;
685
+ struct tm tmbuf;
688
686
689
- StartDay = (localtime (&Start)->tm_hour + 1 ) % 24 ;
690
- FutureDay = (localtime (&Future)->tm_hour + 1 ) % 24 ;
687
+ StartDay = (localtime_r (&Start,&tmbuf )->tm_hour + 1 ) % 24 ;
688
+ FutureDay = (localtime_r (&Future,&tmbuf )->tm_hour + 1 ) % 24 ;
691
689
return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60 ;
692
690
}
693
691
@@ -864,7 +862,6 @@ static int date_lex(YYSTYPE *yylval)
864
862
865
863
time_t parsedate (char *p, TIMEINFO *now)
866
864
{
867
- extern int date_parse (void );
868
865
struct tm *tm , tmbuf;
869
866
TIMEINFO ti;
870
867
time_t Start;
@@ -895,7 +892,7 @@ time_t parsedate(char *p, TIMEINFO *now)
895
892
yyHaveRel = 0 ;
896
893
yyHaveTime = 0 ;
897
894
898
- if (date_parse () || yyHaveTime > 1 || yyHaveDate > 1 )
895
+ if (date_parse (YYPARSE_PARAM_ARG ) || yyHaveTime > 1 || yyHaveDate > 1 )
899
896
return -1 ;
900
897
901
898
if (yyHaveDate || yyHaveTime) {
0 commit comments