[PATCH] add $unixtime to http variables

Roberto De Ioris roberto at unbit.it
Tue Sep 21 09:00:37 MSD 2010

> On Mon, Sep 20, 2010 at 10:43 PM, Roberto De Ioris <roberto at unbit.it>
> wrote:
>> Sorry, i think for this purpose it is betetr to use
>> r->start_sec instead of time(NULL).
>> What do you think about it ?
> When I made the same patch nearly 2 years ago, I used
> ngx_cached_time->sec.

I would like to have (with the most possible accuracy) the time
when the request starts. (this will allow to reliably calculate
overload problems)

ngx_cached_time->sec can be different (oh yes we are talking about
milliseconds, but why not maintaining accuracy :) )

This is the relevant nginx code:

tp = ngx_timeofday();
r->start_sec = tp->sec;
r->start_msec = tp->msec;

#define ngx_timeofday()      (ngx_time_t *) ngx_cached_time

Roberto De Ioris

More information about the nginx mailing list