# HG changeset patch # User Vladimir Homutov # Date 1528102760 -10800 # Node ID 2bc348966475a4e848373d90cd1e9f9734d8fe04 # Parent b2d6594d26784071134166f262cca9e16d7b1b70 Development guide: updated Time and Events chapters. The ngx_current_msec variable description was changed and moved into appropriate section. diff --git a/xml/en/docs/dev/development_guide.xml b/xml/en/docs/dev/development_guide.xml --- 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 ngx_current_msec variable holds the number -of milliseconds elapsed since Epoch and truncated to -ngx_msec_t. @@ -2582,13 +2579,19 @@ event handler. 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 ngx_msec_t type. +Its current value can be obtained from the ngx_current_msec +variable. + + + The function ngx_add_timer(ev, timer) sets a timeout for an event, ngx_del_timer(ev) deletes a previously set timeout. The global timeout red-black tree ngx_event_timer_rbtree stores all timeouts currently set. The key in the tree is of type ngx_msec_t and is the time -when the event expires, expressed in milliseconds since the midnight on of -January 1, 1970 modulus ngx_msec_t 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.