… | |
… | |
124 | this argument. |
124 | this argument. |
125 | |
125 | |
126 | =head2 TIME REPRESENTATION |
126 | =head2 TIME REPRESENTATION |
127 | |
127 | |
128 | Libev represents time as a single floating point number, representing |
128 | Libev represents time as a single floating point number, representing |
129 | the (fractional) number of seconds since the (POSIX) epoch (in practise |
129 | the (fractional) number of seconds since the (POSIX) epoch (in practice |
130 | somewhere near the beginning of 1970, details are complicated, don't |
130 | somewhere near the beginning of 1970, details are complicated, don't |
131 | ask). This type is called C<ev_tstamp>, which is what you should use |
131 | ask). This type is called C<ev_tstamp>, which is what you should use |
132 | too. It usually aliases to the C<double> type in C. When you need to do |
132 | too. It usually aliases to the C<double> type in C. When you need to do |
133 | any calculations on it, you should treat it as some floating point value. |
133 | any calculations on it, you should treat it as some floating point value. |
134 | |
134 | |
… | |
… | |
165 | |
165 | |
166 | =item ev_tstamp ev_time () |
166 | =item ev_tstamp ev_time () |
167 | |
167 | |
168 | Returns the current time as libev would use it. Please note that the |
168 | Returns the current time as libev would use it. Please note that the |
169 | C<ev_now> function is usually faster and also often returns the timestamp |
169 | C<ev_now> function is usually faster and also often returns the timestamp |
170 | you actually want to know. |
170 | you actually want to know. Also interetsing is the combination of |
|
|
171 | C<ev_update_now> and C<ev_now>. |
171 | |
172 | |
172 | =item ev_sleep (ev_tstamp interval) |
173 | =item ev_sleep (ev_tstamp interval) |
173 | |
174 | |
174 | Sleep for the given interval: The current thread will be blocked until |
175 | Sleep for the given interval: The current thread will be blocked until |
175 | either it is interrupted or the given time interval has passed. Basically |
176 | either it is interrupted or the given time interval has passed. Basically |
… | |
… | |
192 | as this indicates an incompatible change. Minor versions are usually |
193 | as this indicates an incompatible change. Minor versions are usually |
193 | compatible to older versions, so a larger minor version alone is usually |
194 | compatible to older versions, so a larger minor version alone is usually |
194 | not a problem. |
195 | not a problem. |
195 | |
196 | |
196 | Example: Make sure we haven't accidentally been linked against the wrong |
197 | Example: Make sure we haven't accidentally been linked against the wrong |
197 | version (note, however, that this will not detect ABI mismatches :). |
198 | version (note, however, that this will not detect other ABI mismatches, |
|
|
199 | such as LFS or reentrancy). |
198 | |
200 | |
199 | assert (("libev version mismatch", |
201 | assert (("libev version mismatch", |
200 | ev_version_major () == EV_VERSION_MAJOR |
202 | ev_version_major () == EV_VERSION_MAJOR |
201 | && ev_version_minor () >= EV_VERSION_MINOR)); |
203 | && ev_version_minor () >= EV_VERSION_MINOR)); |
202 | |
204 | |
… | |
… | |
213 | assert (("sorry, no epoll, no sex", |
215 | assert (("sorry, no epoll, no sex", |
214 | ev_supported_backends () & EVBACKEND_EPOLL)); |
216 | ev_supported_backends () & EVBACKEND_EPOLL)); |
215 | |
217 | |
216 | =item unsigned int ev_recommended_backends () |
218 | =item unsigned int ev_recommended_backends () |
217 | |
219 | |
218 | Return the set of all backends compiled into this binary of libev and also |
220 | Return the set of all backends compiled into this binary of libev and |
219 | recommended for this platform. This set is often smaller than the one |
221 | also recommended for this platform, meaning it will work for most file |
|
|
222 | descriptor types. This set is often smaller than the one returned by |
220 | returned by C<ev_supported_backends>, as for example kqueue is broken on |
223 | C<ev_supported_backends>, as for example kqueue is broken on most BSDs |
221 | most BSDs and will not be auto-detected unless you explicitly request it |
224 | and will not be auto-detected unless you explicitly request it (assuming |
222 | (assuming you know what you are doing). This is the set of backends that |
225 | you know what you are doing). This is the set of backends that libev will |
223 | libev will probe for if you specify no backends explicitly. |
226 | probe for if you specify no backends explicitly. |
224 | |
227 | |
225 | =item unsigned int ev_embeddable_backends () |
228 | =item unsigned int ev_embeddable_backends () |
226 | |
229 | |
227 | Returns the set of backends that are embeddable in other event loops. This |
230 | Returns the set of backends that are embeddable in other event loops. This |
228 | is the theoretical, all-platform, value. To find which backends |
231 | value is platform-specific but can include backends not available on the |
229 | might be supported on the current system, you would need to look at |
232 | current system. To find which embeddable backends might be supported on |
230 | C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for |
233 | the current system, you would need to look at C<ev_embeddable_backends () |
231 | recommended ones. |
234 | & ev_supported_backends ()>, likewise for recommended ones. |
232 | |
235 | |
233 | See the description of C<ev_embed> watchers for more info. |
236 | See the description of C<ev_embed> watchers for more info. |
234 | |
237 | |
235 | =item ev_set_allocator (void *(*cb)(void *ptr, long size)) [NOT REENTRANT] |
238 | =item ev_set_allocator (void *(*cb)(void *ptr, long size)) [NOT REENTRANT] |
236 | |
239 | |