Mercurial > hg > nginx
comparison src/os/unix/ngx_time.c @ 179:9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 11 Nov 2003 18:13:43 +0000 |
parents | a8ff48d26cca |
children | 4b1a3a4acc60 |
comparison
equal
deleted
inserted
replaced
178:a8ff48d26cca | 179:9f3a78b06c48 |
---|---|
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 | 4 |
5 | 5 |
6 void ngx_localtime(ngx_tm_t *tm) | 6 void ngx_localtime(ngx_tm_t *tm) |
7 { | 7 { |
8 #if (HAVE_LOCALTIME_R) | |
9 | |
8 localtime_r(&ngx_cached_time, tm); | 10 localtime_r(&ngx_cached_time, tm); |
11 | |
12 #else | |
13 ngx_tm_t *t; | |
14 | |
15 t = localtime(&ngx_cached_time); | |
16 *tm = *t; | |
17 | |
18 #endif | |
9 | 19 |
10 tm->ngx_tm_mon++; | 20 tm->ngx_tm_mon++; |
11 tm->ngx_tm_year += 1900; | 21 tm->ngx_tm_year += 1900; |
12 } | 22 } |
13 | 23 |
14 u_int ngx_msec(void) | |
15 { | |
16 struct timeval tv; | |
17 | |
18 gettimeofday(&tv, NULL); | |
19 | |
20 return tv.tv_sec * 1000 + tv.tv_usec / 1000; | |
21 } | |
22 | 24 |
23 | 25 |
24 #if 0 | 26 #if 0 |
25 | 27 |
26 typedef struct { | 28 typedef struct { |