nginx/src/os/unix/ngx_time.c

32 lines
384 B
C
Raw Normal View History

/*
* Copyright (C) Igor Sysoev
*/
#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-06-28 02:01:57 +08:00
time_t now;
2003-11-12 02:13:43 +08:00
2004-06-28 02:01:57 +08:00
now = ngx_time();
localtime_r(&now, tm);
2003-11-11 05:09:22 +08:00
2003-11-12 02:13:43 +08:00
#else
2004-06-28 02:01:57 +08:00
time_t now;
2003-11-12 02:13:43 +08:00
ngx_tm_t *t;
2004-06-28 02:01:57 +08:00
now = ngx_time();
t = localtime(&now);
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;
}