aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_time.c')
-rw-r--r--src/os/unix/ngx_time.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/os/unix/ngx_time.c b/src/os/unix/ngx_time.c
index bf3432ba7..37039918e 100644
--- a/src/os/unix/ngx_time.c
+++ b/src/os/unix/ngx_time.c
@@ -5,22 +5,24 @@
void ngx_localtime(ngx_tm_t *tm)
{
+#if (HAVE_LOCALTIME_R)
+
localtime_r(&ngx_cached_time, tm);
- tm->ngx_tm_mon++;
- tm->ngx_tm_year += 1900;
-}
+#else
+ ngx_tm_t *t;
-u_int ngx_msec(void)
-{
- struct timeval tv;
+ t = localtime(&ngx_cached_time);
+ *tm = *t;
- gettimeofday(&tv, NULL);
+#endif
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ tm->ngx_tm_mon++;
+ tm->ngx_tm_year += 1900;
}
+
#if 0
typedef struct {