<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="readclock">
  <refmeta>
    <refentrytitle>readclock</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>readclock</refname>

    <refpurpose>
      Reads the value of an internal clock.
      <indexterm id="IndexReadClock"><primary>readclock</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      Reads the value of an internal clock.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>ir <command>readclock</command> inum</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>inum</emphasis> -- the number of a clock.  There are 32 clocks numbered 0 through 31. All other values are mapped to clock number 32.
    </para>

    <para>
      <emphasis>ir</emphasis> -- value at i-time, of the clock specified by <emphasis>inum</emphasis>
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      Between a <link linkend="clockon"><citetitle>clockon</citetitle></link> and a <link linkend="clockoff"><citetitle>clockoff</citetitle></link> opcode, the CPU time used is accumulated in the clock. The precision is machine dependent but is the millisecond range on UNIX and Windows systems. The <emphasis>readclock</emphasis> opcde reads the current value of a clock at initialization time.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the readclock opcode. It uses the files <ulink url="examples/readclock.orc"><citetitle>readclock.orc</citetitle></ulink> and <ulink url="examples/readclock.sco"><citetitle>readclock.sco</citetitle></ulink>.

      <example>
        <title>Example of the readclock opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/readclock.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/readclock.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>

      Its output should include lines like this:
      <screen>
instr 1:  i1 = 0.000
instr 1:  i1 = 90.000
instr 1:  i1 = 180.000
      </screen>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="clockoff"><citetitle>clockoff</citetitle></link>, <link linkend="clockon"><citetitle>clockon</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namejohn;</member>
        <member>University of Bath/Codemist Ltd.</member>
        <member>Bath, UK</member>
        <member>July, 1999</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>

    <para>New in Csound version 3.56</para>
  </refsect1>
</refentry>
