28
28
/*
29
29
* print.c - debugging printout routines
30
30
*/
31
- #define _GNU_SOURCE
32
31
#include "php.h"
33
32
34
33
#include "file.h"
@@ -45,11 +44,6 @@ FILE_RCSID("@(#)$File: print.c,v 1.82 2017/02/10 18:14:01 christos Exp $")
45
44
#endif
46
45
#include <time.h>
47
46
48
- #ifdef PHP_WIN32
49
- # define asctime_r php_asctime_r
50
- # define ctime_r php_ctime_r
51
- #endif
52
-
53
47
#define SZOF (a ) (sizeof(a) / sizeof(a[0]))
54
48
55
49
#include "cdf.h"
@@ -240,8 +234,8 @@ protected const char *
240
234
file_fmttime (uint64_t v , int flags , char * buf )
241
235
{
242
236
char * pp ;
243
- time_t t = ( time_t ) v ;
244
- struct tm * tm = NULL ;
237
+ time_t t ;
238
+ struct tm * tm , tmz ;
245
239
246
240
if (flags & FILE_T_WINDOWS ) {
247
241
struct timespec ts ;
@@ -254,33 +248,13 @@ file_fmttime(uint64_t v, int flags, char *buf)
254
248
}
255
249
256
250
if (flags & FILE_T_LOCAL ) {
257
- pp = ctime_r (& t , buf );
251
+ tm = php_localtime_r (& t , & tmz );
258
252
} else {
259
- #ifndef HAVE_DAYLIGHT
260
- private int daylight = 0 ;
261
- #ifdef HAVE_TM_ISDST
262
- private time_t now = (time_t )0 ;
263
-
264
- if (now == (time_t )0 ) {
265
- struct tm * tm1 ;
266
- (void )time (& now );
267
- tm1 = localtime (& now );
268
- if (tm1 == NULL )
269
- goto out ;
270
- daylight = tm1 -> tm_isdst ;
271
- }
272
- #endif /* HAVE_TM_ISDST */
273
- #endif /* HAVE_DAYLIGHT */
274
- if (daylight )
275
- t += 3600 ;
276
- tm = gmtime (& t );
277
- if (tm == NULL )
278
- goto out ;
279
- pp = asctime_r (tm , buf );
253
+ tm = php_gmtime_r (& t , & tmz );
280
254
}
281
255
if (tm == NULL )
282
256
goto out ;
283
- pp = asctime_r (tm , buf );
257
+ pp = php_asctime_r (tm , buf );
284
258
285
259
if (pp == NULL )
286
260
goto out ;
0 commit comments