New examples (from now)
[scilab.git] / scilab / modules / time / help / en_US / realtime.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA - 
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="realtime">
14     <refnamediv xml:id="realtimeinit">
15         <refname>realtimeinit</refname>
16         <refpurpose>set  time unit</refpurpose>
17     </refnamediv>
18     <refnamediv>
19         <refname>realtime</refname>
20         <refpurpose>set  dates origin or waits until date</refpurpose>
21     </refnamediv>
22     <refsynopsisdiv>
23         <title>Calling Sequence</title>
24         <synopsis>realtimeinit(time_unit)
25             realtime(t)
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>time_unit</term>
33                 <listitem>
34                     <para>
35                         a real number. The number of seconds associated to the <literal>realtime</literal> argument
36                     </para>
37                 </listitem>
38             </varlistentry>
39             <varlistentry>
40                 <term>t</term>
41                 <listitem>
42                     <para>a real number.  A date</para>
43                 </listitem>
44             </varlistentry>
45         </variablelist>
46     </refsection>
47     <refsection>
48         <title>Description</title>
49         <para>   These two functions can be used to handle real time into Scilab.</para>
50         <para>
51             <literal>realtimeinit(time_unit)</literal>  defines the time unit
52             associated to the <literal>realtime</literal> argument <literal>t</literal>
53         </para>
54         <para>
55             first call to <literal>realtime(t0)</literal> sets current date to
56             (<literal>t0</literal>).
57             subsequent calls to <literal>realtime(t)</literal> wait till date <literal>t</literal> is
58             reached.
59         </para>
60     </refsection>
61     <refsection>
62         <title>Examples</title>
63         <programlisting role="example"><![CDATA[ 
64 realtimeinit(1/2);//sets time unit to half a second
65 realtime(0);//sets current date to 0
66 for k=1:10
67   realtime(k);
68   mprintf('current time is '+string(k/2)+'sec .\r\n');
69 end
70
71 //next instruction outputs a dot each 2 seconds
72 realtimeinit(2);
73 realtime(0);
74 for k=1:10
75   realtime(k);
76   mprintf('.\r\n');
77 end
78
79 realtimeinit(1);
80 realtime(0);
81 dt=getdate('s');
82 realtime(10);
83 getdate('s')-dt
84  ]]></programlisting>
85     </refsection>
86         <programlisting role="example"><![CDATA[ 
87 realtimeinit(1);
88 realtime(0);
89 t1 = now()
90 datevec(t1)
91 realtime(10);
92 t1 = now()
93 datevec(t1)
94  ]]></programlisting>
95
96     <refsection role="see also">
97         <title>See Also</title>
98         <simplelist type="inline">
99             <member>
100                 <link linkend="getdate">getdate</link>
101             </member>
102         </simplelist>
103     </refsection>
104 </refentry>