1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <ngx_config.h> #include <ngx_time.h> void ngx_localtime(ngx_tm_t *tm) { time_t clock = time(NULL); localtime_r(&clock, tm); } u_int ngx_msec(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000 + tv.tv_usec / 1000; }