Mercurial > hg > nginx-site
changeset 2170:2bc348966475
Development guide: updated Time and Events chapters.
The ngx_current_msec variable description was changed and moved into
appropriate section.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 04 Jun 2018 11:59:20 +0300 |
parents | b2d6594d2678 |
children | b37374af4099 |
files | xml/en/docs/dev/development_guide.xml |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/dev/development_guide.xml +++ b/xml/en/docs/dev/development_guide.xml @@ -733,9 +733,6 @@ on Windows. To obtain the current time, it is usually sufficient to access one of the available global variables, representing the cached time value in the desired format. -For example, the <literal>ngx_current_msec</literal> variable holds the number -of milliseconds elapsed since Epoch and truncated to -<literal>ngx_msec_t</literal>. </para> <para> @@ -2582,13 +2579,19 @@ event handler. <para> An event can be set to send a notification when a timeout expires. +The timer used by events counts milliseconds since some unspecified point +in the past truncated to <literal>ngx_msec_t</literal> type. +Its current value can be obtained from the <literal>ngx_current_msec</literal> +variable. +</para> + +<para> The function <literal>ngx_add_timer(ev, timer)</literal> sets a timeout for an event, <literal>ngx_del_timer(ev)</literal> deletes a previously set timeout. The global timeout red-black tree <literal>ngx_event_timer_rbtree</literal> stores all timeouts currently set. The key in the tree is of type <literal>ngx_msec_t</literal> and is the time -when the event expires, expressed in milliseconds since the midnight on of -January 1, 1970 modulus <literal>ngx_msec_t</literal> max value. +when the event occurs. The tree structure enables fast insertion and deletion operations, as well as access to the nearest timeouts, which nginx uses to find out how long to wait for I/O events and for expiring timeout events.