{
size_t size;
ngx_int_t rc, excess;
- ngx_time_t *tp;
ngx_msec_t now;
ngx_msec_int_t ms;
ngx_rbtree_node_t *node, *sentinel;
ngx_http_limit_req_ctx_t *ctx;
ngx_http_limit_req_node_t *lr;
- tp = ngx_timeofday();
- now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
+ now = ngx_current_msec;
ctx = limit->shm_zone->data;
ngx_uint_t *ep, ngx_http_limit_req_limit_t **limit)
{
ngx_int_t excess;
- ngx_time_t *tp;
ngx_msec_t now, delay, max_delay;
ngx_msec_int_t ms;
ngx_http_limit_req_ctx_t *ctx;
ngx_shmtx_lock(&ctx->shpool->mutex);
- tp = ngx_timeofday();
-
- now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
+ now = ngx_current_msec;
ms = (ngx_msec_int_t) (now - lr->last);
excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;
ngx_http_limit_req_expire(ngx_http_limit_req_ctx_t *ctx, ngx_uint_t n)
{
ngx_int_t excess;
- ngx_time_t *tp;
ngx_msec_t now;
ngx_queue_t *q;
ngx_msec_int_t ms;
ngx_rbtree_node_t *node;
ngx_http_limit_req_node_t *lr;
- tp = ngx_timeofday();
-
- now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
+ now = ngx_current_msec;
/*
* n == 1 deletes one or two zero rate entries
ngx_http_ssi_date_gmt_local_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t gmt)
{
+ time_t now;
ngx_http_ssi_ctx_t *ctx;
- ngx_time_t *tp;
ngx_str_t *timefmt;
struct tm tm;
char buf[NGX_HTTP_SSI_DATE_LEN];
v->no_cacheable = 0;
v->not_found = 0;
- tp = ngx_timeofday();
+ now = ngx_time();
ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module);
return NGX_ERROR;
}
- v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
+ v->len = ngx_sprintf(v->data, "%T", now) - v->data;
return NGX_OK;
}
if (gmt) {
- ngx_libc_gmtime(tp->sec, &tm);
+ ngx_libc_gmtime(now, &tm);
} else {
- ngx_libc_localtime(tp->sec, &tm);
+ ngx_libc_localtime(now, &tm);
}
v->len = strftime(buf, NGX_HTTP_SSI_DATE_LEN,