@@ -76,7 +76,12 @@ typedef int gid_t;
76
76
#endif
77
77
#include <fcntl.h>
78
78
#include <signal.h>
79
+
80
+ #ifndef PHP_WIN32
79
81
#include <time.h>
82
+ #else
83
+ #include "win32/time.h"
84
+ #endif
80
85
81
86
#ifndef ZEND_WIN32
82
87
# include <sys/types.h>
@@ -1164,33 +1169,31 @@ zend_result validate_timestamp_and_record(zend_persistent_script *persistent_scr
1164
1169
return SUCCESS ; /* Don't check timestamps of preloaded scripts */
1165
1170
}
1166
1171
1172
+ double revalidate_reference_time = 0.0 ;
1173
+
1167
1174
if (ZCG (cli_mode )) {
1175
+ #if HAVE_GETTIMEOFDAY
1168
1176
struct timeval tp = {0 };
1169
1177
1170
- //check current time as opposed to the "time of request"
1171
- if (gettimeofday (& tp , NULL ) != 0 ) {
1172
- return SUCCESS ;
1173
- }
1174
-
1175
- double now = (double )(tp .tv_sec + tp .tv_usec / 1000000.00 );
1176
-
1177
- if (ZCG (accel_directives ).revalidate_freq && persistent_script -> dynamic_members .revalidate >= now ) {
1178
- return SUCCESS ;
1179
- } else if (do_validate_timestamps (persistent_script , file_handle ) == FAILURE ) {
1180
- return FAILURE ;
1178
+ if (UNEXPECTED (gettimeofday (& tp , NULL ) != 0 )) {
1179
+ revalidate_reference_time = (double )time (NULL );
1181
1180
} else {
1182
- persistent_script -> dynamic_members .revalidate = now + ZCG (accel_directives ).revalidate_freq ;
1183
- return SUCCESS ;
1181
+ revalidate_reference_time = (double )(tp .tv_sec + tp .tv_usec / 1000000.00 );
1184
1182
}
1183
+ #else
1184
+ revalidate_reference_time = (double )time (NULL );
1185
+ #endif
1185
1186
} else {
1186
- if (ZCG (accel_directives ).revalidate_freq && persistent_script -> dynamic_members .revalidate >= ZCG (request_time )) {
1187
- return SUCCESS ;
1188
- } else if (do_validate_timestamps (persistent_script , file_handle ) == FAILURE ) {
1189
- return FAILURE ;
1190
- } else {
1191
- persistent_script -> dynamic_members .revalidate = ZCG (request_time ) + ZCG (accel_directives ).revalidate_freq ;
1192
- return SUCCESS ;
1193
- }
1187
+ revalidate_reference_time = (double )ZCG (request_time );
1188
+ }
1189
+
1190
+ if (ZCG (accel_directives ).revalidate_freq && persistent_script -> dynamic_members .revalidate >= revalidate_reference_time ) {
1191
+ return SUCCESS ;
1192
+ } else if (do_validate_timestamps (persistent_script , file_handle ) == FAILURE ) {
1193
+ return FAILURE ;
1194
+ } else {
1195
+ persistent_script -> dynamic_members .revalidate = revalidate_reference_time + ZCG (accel_directives ).revalidate_freq ;
1196
+ return SUCCESS ;
1194
1197
}
1195
1198
}
1196
1199
0 commit comments