ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.292 by sf-exg, Mon Mar 22 09:57:01 2010 UTC vs.
Revision 1.295 by root, Sat Jun 26 09:56:57 2010 UTC

124this argument. 124this argument.
125 125
126=head2 TIME REPRESENTATION 126=head2 TIME REPRESENTATION
127 127
128Libev represents time as a single floating point number, representing 128Libev represents time as a single floating point number, representing
129the (fractional) number of seconds since the (POSIX) epoch (somewhere 129the (fractional) number of seconds since the (POSIX) epoch (in practise
130near the beginning of 1970, details are complicated, don't ask). This 130somewhere near the beginning of 1970, details are complicated, don't
131type is called C<ev_tstamp>, which is what you should use too. It usually 131ask). This type is called C<ev_tstamp>, which is what you should use
132aliases to the C<double> type in C. When you need to do any calculations 132too. It usually aliases to the C<double> type in C. When you need to do
133on it, you should treat it as some floating point value. Unlike the name 133any calculations on it, you should treat it as some floating point value.
134
134component C<stamp> might indicate, it is also used for time differences 135Unlike the name component C<stamp> might indicate, it is also used for
135throughout libev. 136time differences (e.g. delays) throughout libev.
136 137
137=head1 ERROR HANDLING 138=head1 ERROR HANDLING
138 139
139Libev knows three classes of errors: operating system errors, usage errors 140Libev knows three classes of errors: operating system errors, usage errors
140and internal errors (bugs). 141and internal errors (bugs).
191as this indicates an incompatible change. Minor versions are usually 192as this indicates an incompatible change. Minor versions are usually
192compatible to older versions, so a larger minor version alone is usually 193compatible to older versions, so a larger minor version alone is usually
193not a problem. 194not a problem.
194 195
195Example: Make sure we haven't accidentally been linked against the wrong 196Example: Make sure we haven't accidentally been linked against the wrong
196version. 197version (note, however, that this will not detect ABI mismatches :).
197 198
198 assert (("libev version mismatch", 199 assert (("libev version mismatch",
199 ev_version_major () == EV_VERSION_MAJOR 200 ev_version_major () == EV_VERSION_MAJOR
200 && ev_version_minor () >= EV_VERSION_MINOR)); 201 && ev_version_minor () >= EV_VERSION_MINOR));
201 202
1773 callback (loop, timer, EV_TIMER); 1774 callback (loop, timer, EV_TIMER);
1774 1775
1775And when there is some activity, simply store the current time in 1776And when there is some activity, simply store the current time in
1776C<last_activity>, no libev calls at all: 1777C<last_activity>, no libev calls at all:
1777 1778
1778 last_actiivty = ev_now (loop); 1779 last_activity = ev_now (loop);
1779 1780
1780This technique is slightly more complex, but in most cases where the 1781This technique is slightly more complex, but in most cases where the
1781time-out is unlikely to be triggered, much more efficient. 1782time-out is unlikely to be triggered, much more efficient.
1782 1783
1783Changing the timeout is trivial as well (if it isn't hard-coded in the 1784Changing the timeout is trivial as well (if it isn't hard-coded in the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines