Created
March 1, 2010 19:08
Revisions
-
rkbodenner revised this gist
Apr 12, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,7 @@ + return NGX_ERROR; + } + + uint64_t usec = (((uint64_t)r->start_sec * 1000 * 1000) + ((uint64_t)r->start_msec * 1000)); + + v->len = ngx_sprintf(p, "%L", usec) - p; + v->valid = 1; -
rkbodenner created this gist
Mar 1, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ --- src/http/ngx_http_variables.c.orig 2010-01-11 03:21:46.000000000 -0800 +++ src/http/ngx_http_variables.c 2010-02-18 10:01:32.000000000 -0800 @@ -93,6 +93,9 @@ static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + /* * TODO: * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED @@ -253,6 +256,9 @@ { ngx_string("pid"), NULL, ngx_http_variable_pid, 0, 0, 0 }, + { ngx_string("start_time"), NULL, ngx_http_variable_start_time, + 0, 0, 0 }, + { ngx_null_string, NULL, NULL, 0, 0, 0 } }; @@ -1749,6 +1755,27 @@ return re; } +static ngx_int_t +ngx_http_variable_start_time(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(r->pool, NGX_INT64_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + uint64_t usec = ((r->start_sec * 1000 * 1000) + (r->start_msec * 1000)); + + v->len = ngx_sprintf(p, "%L", usec) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} ngx_int_t ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, ngx_str_t *s)