<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'class.evperiodic.php',
    1 => 'EvPeriodic',
    2 => 'The EvPeriodic class',
  ),
  'up' => 
  array (
    0 => 'book.ev.php',
    1 => 'Ev',
  ),
  'prev' => 
  array (
    0 => 'evloop.verify.php',
    1 => 'EvLoop::verify',
  ),
  'next' => 
  array (
    0 => 'evperiodic.again.php',
    1 => 'EvPeriodic::again',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ev/evperiodic.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.evperiodic.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

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

  <div class="section" id="evperiodic.intro">
   <h2 class="title">はじめに</h2>
  <p class="simpara">
    Periodic watchers are also timers of a kind, but they are very versatile.
   </p>
   <p class="simpara">
    Unlike
    <span class="classname"><a href="class.evtimer.php" class="classname">EvTimer</a></span>,
    <span class="classname"><strong class="classname">EvPeriodic</strong></span>
    watchers are not based on real time(or relative time, the physical time
    that passes) but on wall clock time(absolute time, calendar or clock). The
    difference is that wall clock time can run faster or slower than real
    time, and time jumps are not uncommon(e.g. when adjusting it).
   </p>
   <p class="simpara">
    <span class="classname"><strong class="classname">EvPeriodic</strong></span>
    watcher can be configured to trigger after some specific point in time.
    For example, if an
    <span class="classname"><strong class="classname">EvPeriodic</strong></span>
    watcher is configured to trigger
    <em>&quot;in 10 seconds&quot;</em>
    (e.g.
    <span class="methodname"><a href="evloop.now.php" class="methodname">EvLoop::now()</a></span>
    +
    <code class="literal">10.0</code>,
    i.e. an absolute time, not a delay), and the system clock is reset to
    <em>January of the previous year</em>,
    then it will take a year or more to trigger the event (unlike an
    <span class="classname"><a href="class.evtimer.php" class="classname">EvTimer</a></span>,
    which would still trigger roughly
    <code class="literal">10</code>
    seconds after starting it as it uses a relative timeout).
   </p>
   <p class="simpara">
    As with timers, the callback is guaranteed to be invoked only when the
    point in time where it is supposed to trigger has passed. If multiple
    timers become ready during the same loop iteration then the ones with
    earlier time-out values are invoked before ones 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>
  </div>

  <div class="section" id="evperiodic.synopsis">
   <h2 class="title">クラス概要</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">EvPeriodic</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">/* プロパティ */</div>
    <div class="fieldsynopsis">
     <span class="modifier">public</span>
      <var class="varname"><a href="class.evperiodic.php#evperiodic.props.offset">$<var class="varname">offset</var></a></var>;</div>

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

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 継承したプロパティ */</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">/* メソッド */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><a href="evperiodic.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">$offset</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$interval</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">$reschedule_cb</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="evperiodic.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">public</span>
   <span class="methodname"><a href="evperiodic.at.php" class="methodname">at</a></span>(): <span class="type"><a href="language.types.float.php" class="type float">float</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="evperiodic.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">$offset</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">$interval</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">$reschedule_cb</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.evperiodic.php" class="type EvPeriodic">EvPeriodic</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="evperiodic.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">$offset</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$interval</code>
   </span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 継承したメソッド */</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="evperiodic.props">
   <h2 class="title">プロパティ</h2>
   <dl>
    
     <dt id="evperiodic.props.offset">
      <var class="varname">offset</var>
     </dt>
     <dd>
      <span class="simpara">
       When repeating, this contains the offset value, otherwise this is the
       absolute point in time(the offset value passed to
       <span class="methodname"><a href="evperiodic.set.php" class="methodname">EvPeriodic::set()</a></span>,
       although
       <em>libev</em>
       might modify this value for better numerical stability).
      </span>
     </dd>
    
    
     <dt id="evperiodic.props.interval">
      <var class="varname">interval</var>
     </dt>
     <dd>
      <span class="simpara">
       The current interval value. Can be modified any time, but changes only
       take effect when the periodic timer fires or
       <span class="methodname"><a href="evperiodic.again.php" class="methodname">EvPeriodic::again()</a></span>
       is being called.
      </span>
     </dd>
    
   </dl>
  </div>

 </div>

 

























<h2>目次</h2><ul class="chunklist chunklist_reference"><li><a href="evperiodic.again.php">EvPeriodic::again</a> — Simply stops and restarts the periodic watcher again</li><li><a href="evperiodic.at.php">EvPeriodic::at</a> — Returns the absolute time that this
  watcher is supposed to trigger next</li><li><a href="evperiodic.construct.php">EvPeriodic::__construct</a> — Constructs EvPeriodic watcher object</li><li><a href="evperiodic.createstopped.php">EvPeriodic::createStopped</a> — Create a stopped EvPeriodic watcher</li><li><a href="evperiodic.set.php">EvPeriodic::set</a> — Configures the watcher</li></ul>
</div>
<?php manual_footer($setup); ?>