Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 834

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The EvTimer class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="evstat.stat.html">EvStat::stat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="evtimer.again.html">EvTimer::again</a></div>
 <div class="up"><a href="book.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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">Introduction</h2>
   <p class="para">
    <strong class="classname">EvTimer</strong>
    watchers are simple relative timers that generate an event after a given
    time, and optionally repeating in regular intervals after that.
   </p>
   <p class="para">
    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 class="emphasis">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="para">
    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.html" class="methodname">EvLoop::run()</a></span>
    recursively).
   </p>
   <p class="para">
    The timer itself will do a best-effort at avoiding drift, that is, if a
    timer is configured to trigger every
    <strong><code>10</code></strong>
    seconds, then it will normally trigger at exactly
    <strong><code>10</code></strong>
    second intervals. If, however, the script cannot keep up with the timer
    because it takes longer than those
    <strong><code>10</code></strong>
    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">Class synopsis</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

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

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
      <var class="varname"><a href="class.evtimer.html#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.html#evtimer.props.remaining">$<var class="varname">remaining</var></a></var>
    ;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited properties */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
      <var class="varname"><a href="class.evwatcher.html#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.html#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.html#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.html#evwatcher.props.priority">$<var class="varname">priority</var></a></var>
    ;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evtimer.again.html" class="methodname">again</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
    <span class="methodname"><a href="evtimer.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$after</code>
   </span>
   , <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$repeat</code>
   </span>
   , <span class="methodparam">
    <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span>
     <code class="parameter">$callback</code>
   </span>
   [, <span class="methodparam">
    <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
     <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code>NULL</code></strong></span>
   </span>
   [, <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">EvTimer</span>
    <span class="methodname"><a href="evtimer.createstopped.html" class="methodname">createStopped</a></span>
    ( <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$after</code>
   </span>
   , <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$repeat</code>
   </span>
   , <span class="methodparam">
    <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span>
     <code class="parameter">$callback</code>
   </span>
   [, <span class="methodparam">
    <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
     <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code>NULL</code></strong></span>
   </span>
   [, <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evtimer.set.html" class="methodname">set</a></span>
    ( <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$after</code>
   </span>
   , <span class="methodparam">
    <span class="type">double</span>
     <code class="parameter">$repeat</code>
   </span>
   )</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited methods */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">int</span>
    <span class="methodname"><a href="evwatcher.clear.html" class="methodname">EvWatcher::clear</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">abstract</span>
   <span class="modifier">public</span>
    <span class="methodname"><a href="evwatcher.construct.html" class="methodname">EvWatcher::__construct</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evwatcher.feed.html" class="methodname">EvWatcher::feed</a></span>
    ( <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$revents</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">EvLoop</span>
    <span class="methodname"><a href="evwatcher.getloop.html" class="methodname">EvWatcher::getLoop</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evwatcher.invoke.html" class="methodname">EvWatcher::invoke</a></span>
    ( <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$revents</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">bool</span>
    <span class="methodname"><a href="evwatcher.keepalive.html" class="methodname">EvWatcher::keepalive</a></span>
    ([ <span class="methodparam">
    <span class="type">bool</span>
     <code class="parameter">$value</code>
   </span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evwatcher.setcallback.html" class="methodname">EvWatcher::setCallback</a></span>
    ( <span class="methodparam">
    <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span>
     <code class="parameter">$callback</code>
   </span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evwatcher.start.html" class="methodname">EvWatcher::start</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
    <span class="methodname"><a href="evwatcher.stop.html" class="methodname">EvWatcher::stop</a></span>
    ( <span class="methodparam">void</span>
   )</div>

   }</div>

  </div>

  <div class="section" id="evtimer.props">
   <h2 class="title">Properties</h2>
   <dl>

    <dt id="evtimer.props.repeat">
     <span class="term">
      <var class="varname"><var class="varname">repeat</var></var>
     </span>
     <dd>

      <p class="para">
       If repeat is
       <strong><code>0.0</code></strong>
       , 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.
      </p>
     </dd>

    </dt>

    <dt id="evtimer.props.remaining">
     <span class="term">
      <var class="varname"><var class="varname">remaining</var></var>
     </span>
     <dd>

      <p class="para">
       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.
      </p>
      <p class="para">
       That is, after instanciating an
       <strong class="classname">EvTimer</strong>
       with an
       <em><code class="parameter">after</code></em>
       value of
       <strong><code>5.0</code></strong>
       and
       <em><code class="parameter">repeat</code></em>
       value of
       <strong><code>7.0</code></strong>
       ,
       <var class="varname"><var class="varname">remaining</var></var>
       returns
       <strong><code>5.0</code></strong>
       . When the timer is started and one second passes,
       <var class="varname"><var class="varname">remaining</var></var>
       will return
       <strong><code>4.0</code></strong>
       . When the timer expires and is restarted, it will return roughly
       <strong><code>7.0</code></strong>
       (likely slightly less as callback invocation takes some time too), and
       so on.
      </p>
     </dd>

    </dt>

   </dl>

  </div>

 </div>

 





















<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="evtimer.again.html">EvTimer::again</a> — Restarts the timer watcher</li><li><a href="evtimer.construct.html">EvTimer::__construct</a> — Constructs an EvTimer watcher object</li><li><a href="evtimer.createstopped.html">EvTimer::createStopped</a> — Creates EvTimer stopped watcher object</li><li><a href="evtimer.set.html">EvTimer::set</a> — Configures the watcher</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="evstat.stat.html">EvStat::stat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="evtimer.again.html">EvTimer::again</a></div>
 <div class="up"><a href="book.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>