<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.ev.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'class.evtimer.php',
    1 => 'EvTimer',
    2 => 'The EvTimer class',
  ),
  'up' => 
  array (
    0 => 'book.ev.php',
    1 => 'Ev',
  ),
  'prev' => 
  array (
    0 => 'evstat.stat.php',
    1 => 'EvStat::stat',
  ),
  'next' => 
  array (
    0 => 'evtimer.again.php',
    1 => 'EvTimer::again',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ev/evtimer.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.evtimer.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.evtimer" class="reference">
 <h1 class="title">The EvTimer class</h1>
 
 <div class="partintro"><p class="verinfo">(PECL ev &gt;= 0.2.0)</p>

  <div class="section" id="evtimer.intro">
   <h2 class="title">Einführung</h2>
   <p class="simpara">
    <span class="classname"><strong class="classname">EvTimer</strong></span>
    watchers are simple relative timers that generate an event after a given
    time, and optionally repeating in regular intervals after that.
   </p>
   <p class="simpara">
    The timers are based on real time, that is, if one registers an event that
    times out after an hour and resets the system clock to
    <em>January last year</em>,
    it will still time out after(roughly) one hour. &quot;Roughly&quot; because
    detecting time jumps is hard, and some inaccuracies are unavoidable.
   </p>
   <p class="simpara">
    The callback is guaranteed to be invoked only after its timeout has passed
    (not at, so on systems with very low-resolution clocks this might
    introduce a small delay). If multiple timers become ready during the same
    loop iteration then the ones with earlier time-out values are invoked
    before ones of the same priority with later time-out values (but this is
    no longer true when a callback calls
    <span class="methodname"><a href="evloop.run.php" class="methodname">EvLoop::run()</a></span>
    recursively).
   </p>
   <p class="simpara">
    The timer itself will do a best-effort at avoiding drift, that is, if a
    timer is configured to trigger every
    <code class="literal">10</code>
    seconds, then it will normally trigger at exactly
    <code class="literal">10</code>
    second intervals. If, however, the script cannot keep up with the timer
    because it takes longer than those
    <code class="literal">10</code>
    seconds to do) the timer will not fire more than once per event loop
    iteration.
   </p>
  </div>

  <div class="section" id="evtimer.synopsis">
   <h2 class="title">Klassenbeschreibung</h2>


   <div class="classsynopsis">
    <span class="ooclass">
     <strong class="classname"></strong>
    </span>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">EvTimer</strong>
     </span>
     <span class="ooclass">
      <span class="modifier">extends</span>
       <a href="class.evwatcher.php" class="classname">EvWatcher</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Eigenschaften */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
      <var class="varname"><a href="class.evtimer.php#evtimer.props.repeat">$<var class="varname">repeat</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.evtimer.php#evtimer.props.remaining">$<var class="varname">remaining</var></a></var>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Geerbte Eigenschaften */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.evwatcher.php#evwatcher.props.is-active">$<var class="varname">is_active</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.evwatcher.php#evwatcher.props.data">$<var class="varname">data</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.evwatcher.php#evwatcher.props.is-pending">$<var class="varname">is_pending</var></a></var>;</div>
<div class="fieldsynopsis"><span class="modifier">public</span>
      <var class="varname"><a href="class.evwatcher.php#evwatcher.props.priority">$<var class="varname">priority</var></a></var>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methoden */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><a href="evtimer.construct.php" class="methodname">__construct</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$after</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$repeat</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span><br>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evtimer.again.php" class="methodname">again</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><a href="evtimer.createstopped.php" class="methodname">createStopped</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$after</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$repeat</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span><br>): <span class="type"><a href="class.evtimer.php" class="type EvTimer">EvTimer</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evtimer.set.php" class="methodname">set</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$after</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$repeat</code>
   </span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Geerbte Methoden */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.clear.php" class="methodname">EvWatcher::clear</a></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.feed.php" class="methodname">EvWatcher::feed</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$revents</code>
   </span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.getloop.php" class="methodname">EvWatcher::getLoop</a></span>(): <span class="type"><a href="class.evloop.php" class="type EvLoop">EvLoop</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.invoke.php" class="methodname">EvWatcher::invoke</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$revents</code>
   </span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.keepalive.php" class="methodname">EvWatcher::keepalive</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$value</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.setcallback.php" class="methodname">EvWatcher::setCallback</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$callback</code>
   </span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.start.php" class="methodname">EvWatcher::start</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evwatcher.stop.php" class="methodname">EvWatcher::stop</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

   }</div>

  </div>

  <div class="section" id="evtimer.props">
   <h2 class="title">Eigenschaften</h2>
   <dl>
    
     <dt id="evtimer.props.repeat">
      <var class="varname">repeat</var>
     </dt>
     <dd>
      <span class="simpara">
       If repeat is
       <code class="literal">0.0</code>,
       then it will automatically be stopped once the timeout is reached. If
       it is positive, then the timer will automatically be configured to
       trigger again every repeat seconds later, until stopped manually.
      </span>
     </dd>
    
    
     <dt id="evtimer.props.remaining">
      <var class="varname">remaining</var>
     </dt>
     <dd>
      <span class="simpara">
       Returns the remaining time until a timer fires. If the timer is active,
       then this time is relative to the current event loop time, otherwise
       it&#039;s the timeout value currently configured.
      </span>
      <span class="simpara">
       That is, after instantiating an
       <span class="classname"><strong class="classname">EvTimer</strong></span>
       with an
       <code class="parameter">after</code>
       value of
       <code class="literal">5.0</code>
       and
       <code class="parameter">repeat</code>
       value of
       <code class="literal">7.0</code>,
       <var class="varname">remaining</var>
       returns
       <code class="literal">5.0</code>.
       When the timer is started and one second passes,
       <var class="varname">remaining</var>
       will return
       <code class="literal">4.0</code>.
       When the timer expires and is restarted, it will return roughly
       <code class="literal">7.0</code>
       (likely slightly less as callback invocation takes some time too), and
       so on.
      </span>
     </dd>
    
   </dl>
  </div>

 </div>

 




















<h2>Inhaltsverzeichnis</h2><ul class="chunklist chunklist_reference"><li><a href="evtimer.again.php">EvTimer::again</a> — Restarts the timer watcher</li><li><a href="evtimer.construct.php">EvTimer::__construct</a> — Constructs an EvTimer watcher object</li><li><a href="evtimer.createstopped.php">EvTimer::createStopped</a> — Creates EvTimer stopped watcher object</li><li><a href="evtimer.set.php">EvTimer::set</a> — Configures the watcher</li></ul>
</div>
<?php manual_footer($setup); ?>