… | |
… | |
174 | =item ev_tstamp ev_time () |
174 | =item ev_tstamp ev_time () |
175 | |
175 | |
176 | Returns the current time as libev would use it. Please note that the |
176 | Returns the current time as libev would use it. Please note that the |
177 | C<ev_now> function is usually faster and also often returns the timestamp |
177 | C<ev_now> function is usually faster and also often returns the timestamp |
178 | you actually want to know. Also interesting is the combination of |
178 | you actually want to know. Also interesting is the combination of |
179 | C<ev_update_now> and C<ev_now>. |
179 | C<ev_now_update> and C<ev_now>. |
180 | |
180 | |
181 | =item ev_sleep (ev_tstamp interval) |
181 | =item ev_sleep (ev_tstamp interval) |
182 | |
182 | |
183 | Sleep for the given interval: The current thread will be blocked |
183 | Sleep for the given interval: The current thread will be blocked |
184 | until either it is interrupted or the given time interval has |
184 | until either it is interrupted or the given time interval has |
… | |
… | |
1991 | delay has actually elapsed, or in other words, it always errs on the "too |
1991 | delay has actually elapsed, or in other words, it always errs on the "too |
1992 | late" side of things. |
1992 | late" side of things. |
1993 | |
1993 | |
1994 | =head3 The special problem of time updates |
1994 | =head3 The special problem of time updates |
1995 | |
1995 | |
1996 | Establishing the current time is a costly operation (it usually takes at |
1996 | Establishing the current time is a costly operation (it usually takes |
1997 | least two system calls): EV therefore updates its idea of the current |
1997 | at least one system call): EV therefore updates its idea of the current |
1998 | time only before and after C<ev_run> collects new events, which causes a |
1998 | time only before and after C<ev_run> collects new events, which causes a |
1999 | growing difference between C<ev_now ()> and C<ev_time ()> when handling |
1999 | growing difference between C<ev_now ()> and C<ev_time ()> when handling |
2000 | lots of events in one iteration. |
2000 | lots of events in one iteration. |
2001 | |
2001 | |
2002 | The relative timeouts are calculated relative to the C<ev_now ()> |
2002 | The relative timeouts are calculated relative to the C<ev_now ()> |
… | |
… | |
2009 | |
2009 | |
2010 | If the event loop is suspended for a long time, you can also force an |
2010 | If the event loop is suspended for a long time, you can also force an |
2011 | update of the time returned by C<ev_now ()> by calling C<ev_now_update |
2011 | update of the time returned by C<ev_now ()> by calling C<ev_now_update |
2012 | ()>. |
2012 | ()>. |
2013 | |
2013 | |
2014 | =head3 The special problem of unsychronised clocks |
2014 | =head3 The special problem of unsynchronised clocks |
2015 | |
2015 | |
2016 | Modern systems have a variety of clocks - libev itself uses the normal |
2016 | Modern systems have a variety of clocks - libev itself uses the normal |
2017 | "wall clock" clock and, if available, the monotonic clock (to avoid time |
2017 | "wall clock" clock and, if available, the monotonic clock (to avoid time |
2018 | jumps). |
2018 | jumps). |
2019 | |
2019 | |