nginx/src/os/unix/ngx_time.c

23 lines
308 B
C
Raw Normal View History

#include <ngx_config.h>
2003-11-11 05:09:22 +08:00
#include <ngx_core.h>
void ngx_localtime(ngx_tm_t *tm)
{
2003-11-12 02:13:43 +08:00
#if (HAVE_LOCALTIME_R)
2004-04-22 02:54:33 +08:00
localtime_r((time_t *) &ngx_cached_time, tm);
2003-11-11 05:09:22 +08:00
2003-11-12 02:13:43 +08:00
#else
ngx_tm_t *t;
2004-04-22 02:54:33 +08:00
t = localtime((time_t *) &ngx_cached_time);
2003-11-12 02:13:43 +08:00
*tm = *t;
2003-11-12 02:13:43 +08:00
#endif
2003-11-12 02:13:43 +08:00
tm->ngx_tm_mon++;
tm->ngx_tm_year += 1900;
}