… | |
… | |
2029 | |
2029 | |
2030 | The relative timeouts are calculated relative to the C<ev_now ()> |
2030 | The relative timeouts are calculated relative to the C<ev_now ()> |
2031 | time. This is usually the right thing as this timestamp refers to the time |
2031 | time. This is usually the right thing as this timestamp refers to the time |
2032 | of the event triggering whatever timeout you are modifying/starting. If |
2032 | of the event triggering whatever timeout you are modifying/starting. If |
2033 | you suspect event processing to be delayed and you I<need> to base the |
2033 | you suspect event processing to be delayed and you I<need> to base the |
2034 | timeout on the current time, use something like this to adjust for this: |
2034 | timeout on the current time, use something like the following to adjust |
|
|
2035 | for it: |
2035 | |
2036 | |
2036 | ev_timer_set (&timer, after + ev_now () - ev_time (), 0.); |
2037 | ev_timer_set (&timer, after + (ev_time () - ev_now ()), 0.); |
2037 | |
2038 | |
2038 | If the event loop is suspended for a long time, you can also force an |
2039 | If the event loop is suspended for a long time, you can also force an |
2039 | update of the time returned by C<ev_now ()> by calling C<ev_now_update |
2040 | update of the time returned by C<ev_now ()> by calling C<ev_now_update |
2040 | ()>. |
2041 | ()>, although that will push the event time of all outstanding events |
|
|
2042 | further into the future. |
2041 | |
2043 | |
2042 | =head3 The special problem of unsynchronised clocks |
2044 | =head3 The special problem of unsynchronised clocks |
2043 | |
2045 | |
2044 | Modern systems have a variety of clocks - libev itself uses the normal |
2046 | Modern systems have a variety of clocks - libev itself uses the normal |
2045 | "wall clock" clock and, if available, the monotonic clock (to avoid time |
2047 | "wall clock" clock and, if available, the monotonic clock (to avoid time |