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

Comparing libev/ev.html (file contents):
Revision 1.20 by root, Mon Nov 12 08:58:27 2007 UTC vs.
Revision 1.21 by root, Mon Nov 12 09:01:12 2007 UTC

4<head> 4<head>
5 <title>libev</title> 5 <title>libev</title>
6 <meta name="description" content="Pod documentation for libev" /> 6 <meta name="description" content="Pod documentation for libev" />
7 <meta name="inputfile" content="&lt;standard input&gt;" /> 7 <meta name="inputfile" content="&lt;standard input&gt;" />
8 <meta name="outputfile" content="&lt;standard output&gt;" /> 8 <meta name="outputfile" content="&lt;standard output&gt;" />
9 <meta name="created" content="Mon Nov 12 09:58:27 2007" /> 9 <meta name="created" content="Mon Nov 12 10:01:12 2007" />
10 <meta name="generator" content="Pod::Xhtml 1.57" /> 10 <meta name="generator" content="Pod::Xhtml 1.57" />
11<link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> 11<link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head>
12<body> 12<body>
13<div class="pod"> 13<div class="pod">
14<!-- INDEX START --> 14<!-- INDEX START -->
99to the double type in C.</p> 99to the double type in C.</p>
100 100
101</div> 101</div>
102<h1 id="GLOBAL_FUNCTIONS">GLOBAL FUNCTIONS</h1><p><a href="#TOP" class="toplink">Top</a></p> 102<h1 id="GLOBAL_FUNCTIONS">GLOBAL FUNCTIONS</h1><p><a href="#TOP" class="toplink">Top</a></p>
103<div id="GLOBAL_FUNCTIONS_CONTENT"> 103<div id="GLOBAL_FUNCTIONS_CONTENT">
104<p>These functions can be called anytime, even before initialising the
105library in any way.</p>
104<dl> 106<dl>
105 <dt>ev_tstamp ev_time ()</dt> 107 <dt>ev_tstamp ev_time ()</dt>
106 <dd> 108 <dd>
107 <p>Returns the current time as libev would use it.</p> 109 <p>Returns the current time as libev would use it.</p>
108 </dd> 110 </dd>
567 <dd> 569 <dd>
568 <p>In this mode the values for <code>interval</code> and <code>at</code> are both being 570 <p>In this mode the values for <code>interval</code> and <code>at</code> are both being
569ignored. Instead, each time the periodic watcher gets scheduled, the 571ignored. Instead, each time the periodic watcher gets scheduled, the
570reschedule callback will be called with the watcher as first, and the 572reschedule callback will be called with the watcher as first, and the
571current time as second argument.</p> 573current time as second argument.</p>
572 <p>NOTE: <i>This callback MUST NOT stop or destroy the periodic or any other 574 <p>NOTE: <i>This callback MUST NOT stop or destroy any periodic watcher,
573periodic watcher, ever, or make any event loop modifications</i>. If you need 575ever, or make any event loop modifications</i>. If you need to stop it,
574to stop it, return <code>now + 1e30</code> (or so, fudge fudge) and stop it afterwards.</p> 576return <code>now + 1e30</code> (or so, fudge fudge) and stop it afterwards (e.g. by
575 <p>Also, <i>this callback must always return a time that is later than the 577starting a prepare watcher).</p>
576passed <code>now</code> value</i>. Not even <code>now</code> itself will be ok.</p>
577 <p>Its prototype is <code>ev_tstamp (*reschedule_cb)(struct ev_periodic *w, 578 <p>Its prototype is <code>ev_tstamp (*reschedule_cb)(struct ev_periodic *w,
578ev_tstamp now)</code>, e.g.:</p> 579ev_tstamp now)</code>, e.g.:</p>
579<pre> static ev_tstamp my_rescheduler (struct ev_periodic *w, ev_tstamp now) 580<pre> static ev_tstamp my_rescheduler (struct ev_periodic *w, ev_tstamp now)
580 { 581 {
581 return now + 60.; 582 return now + 60.;
584</pre> 585</pre>
585 <p>It must return the next time to trigger, based on the passed time value 586 <p>It must return the next time to trigger, based on the passed time value
586(that is, the lowest time value larger than to the second argument). It 587(that is, the lowest time value larger than to the second argument). It
587will usually be called just before the callback will be triggered, but 588will usually be called just before the callback will be triggered, but
588might be called at other times, too.</p> 589might be called at other times, too.</p>
590 <p>NOTE: <i>This callback must always return a time that is later than the
591passed <code>now</code> value</i>. Not even <code>now</code> itself will do, it must be larger.</p>
589 <p>This can be used to create very complex timers, such as a timer that 592 <p>This can be used to create very complex timers, such as a timer that
590triggers on each midnight, local time. To do this, you would calculate the 593triggers on each midnight, local time. To do this, you would calculate the
591next midnight after <code>now</code> and return the timestamp value for this. How you do this 594next midnight after <code>now</code> and return the timestamp value for this. How you do this
592is, again, up to you (but it is not trivial).</p> 595is, again, up to you (but it is not trivial).</p>
593 </dd> 596 </dd>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines