2002-08-07 00:39:45 +08:00
|
|
|
|
2004-09-28 16:34:51 +08:00
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2002-08-07 00:39:45 +08:00
|
|
|
#include <ngx_config.h>
|
2003-11-11 05:09:22 +08:00
|
|
|
#include <ngx_core.h>
|
|
|
|
|
2002-08-07 00:39:45 +08:00
|
|
|
|
|
|
|
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;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2004-06-28 02:01:57 +08:00
|
|
|
now = ngx_time();
|
|
|
|
t = localtime(&now);
|
2003-11-12 02:13:43 +08:00
|
|
|
*tm = *t;
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2003-11-12 02:13:43 +08:00
|
|
|
#endif
|
2002-08-07 00:39:45 +08:00
|
|
|
|
2003-11-12 02:13:43 +08:00
|
|
|
tm->ngx_tm_mon++;
|
|
|
|
tm->ngx_tm_year += 1900;
|
2002-08-07 00:39:45 +08:00
|
|
|
}
|