123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
- <title>uIP 1.0: Timer library</title>
- <link href="doxygen.css" rel="stylesheet" type="text/css">
- <link href="tabs.css" rel="stylesheet" type="text/css">
- </head><body>
- <!-- Generated by Doxygen 1.4.6 -->
- <div class="tabs">
- <ul>
- <li><a href="main.html"><span>Main Page</span></a></li>
- <li><a href="modules.html"><span>Modules</span></a></li>
- <li><a href="classes.html"><span>Data Structures</span></a></li>
- <li><a href="files.html"><span>Files</span></a></li>
- <li><a href="examples.html"><span>Examples</span></a></li>
- </ul></div>
- <h1>Timer library</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
- The timer library provides functions for setting, resetting and restarting timers, and for checking if a timer has expired.
- <p>
- An application must "manually" check if its timers have expired; this is not done automatically.<p>
- A timer is declared as a <code>struct</code> <code>timer</code> and all access to the timer is made by a pointer to the declared timer.<p>
- <dl compact><dt><b>Note:</b></dt><dd>The timer library uses the <a class="el" href="a00157.html">Clock library</a> to measure time. Intervals should be specified in the format used by the clock library. </dd></dl>
- <p>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><td></td></tr>
- <tr><td colspan="2"><br><h2>Files</h2></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="a00130.html">timer.h</a></td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Timer library header file. <br></td></tr>
- <p>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="a00129.html">timer.c</a></td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Timer library implementation. <br></td></tr>
- <p>
- <tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="a00087.html">timer</a></td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">A timer. <a href="a00087.html#_details">More...</a><br></td></tr>
- <tr><td colspan="2"><br><h2>Functions</h2></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#g6614d96fdfcd95c95ec6e6f63071ff51">timer_set</a> (struct <a class="el" href="a00087.html">timer</a> *t, clock_time_t interval)</td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Set a timer. <a href="#g6614d96fdfcd95c95ec6e6f63071ff51"></a><br></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#gedaf3e48c2b04229b85455fb948468d6">timer_reset</a> (struct <a class="el" href="a00087.html">timer</a> *t)</td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the timer with the same interval. <a href="#gedaf3e48c2b04229b85455fb948468d6"></a><br></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#gcb807bd57e5489b386b876af5c1f163a">timer_restart</a> (struct <a class="el" href="a00087.html">timer</a> *t)</td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Restart the timer from the current point in time. <a href="#gcb807bd57e5489b386b876af5c1f163a"></a><br></td></tr>
- <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00156.html#g6d71dececfce707c668e6257aad5906e">timer_expired</a> (struct <a class="el" href="a00087.html">timer</a> *t)</td></tr>
- <tr><td class="mdescLeft"> </td><td class="mdescRight">Check if a timer has expired. <a href="#g6d71dececfce707c668e6257aad5906e"></a><br></td></tr>
- </table>
- <hr><h2>Function Documentation</h2>
- <a class="anchor" name="g6d71dececfce707c668e6257aad5906e"></a><!-- doxytag: member="timer.h::timer_expired" ref="g6d71dececfce707c668e6257aad5906e" args="(struct timer *t)" --><p>
- <table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">int timer_expired </td>
- <td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">struct <a class="el" href="a00087.html">timer</a> * </td>
- <td class="mdname1" valign="top" nowrap> <em>t</em> </td>
- <td class="md" valign="top"> ) </td>
- <td class="md" nowrap></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
- <p>
- Check if a timer has expired.
- <p>
- This function tests if a timer has expired and returns true or false depending on its status.<p>
- <dl compact><dt><b>Parameters:</b></dt><dd>
- <table border="0" cellspacing="2" cellpadding="0">
- <tr><td valign="top"></td><td valign="top"><em>t</em> </td><td>A pointer to the timer</td></tr>
- </table>
- </dl>
- <dl compact><dt><b>Returns:</b></dt><dd>Non-zero if the timer has expired, zero otherwise. </dd></dl>
- <dl compact><dt><b>Examples: </b></dt><dd>
- <a class="el" href="a00048.html#a26">dhcpc.c</a>, <a class="el" href="a00042.html#a77">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a94">example-mainloop-without-arp.c</a>.</dl>
- <p>
- Definition at line <a class="el" href="a00195.html#l00121">121</a> of file <a class="el" href="a00195.html">timer.c</a>.
- <p>
- References <a class="el" href="a00157.html#ge5b7160f2e653725ba5e2024c3cb7bff">clock_time()</a>, <a class="el" href="a00196.html#l00076">interval</a>, and <a class="el" href="a00196.html#l00075">start</a>. </td>
- </tr>
- </table>
- <a class="anchor" name="gedaf3e48c2b04229b85455fb948468d6"></a><!-- doxytag: member="timer.h::timer_reset" ref="gedaf3e48c2b04229b85455fb948468d6" args="(struct timer *t)" --><p>
- <table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">void timer_reset </td>
- <td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">struct <a class="el" href="a00087.html">timer</a> * </td>
- <td class="mdname1" valign="top" nowrap> <em>t</em> </td>
- <td class="md" valign="top"> ) </td>
- <td class="md" nowrap></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
- <p>
- Reset the timer with the same interval.
- <p>
- This function resets the timer with the same interval that was given to the <a class="el" href="a00156.html#g6614d96fdfcd95c95ec6e6f63071ff51">timer_set()</a> function. The start point of the interval is the exact time that the timer last expired. Therefore, this function will cause the timer to be stable over time, unlike the timer_rester() function.<p>
- <dl compact><dt><b>Parameters:</b></dt><dd>
- <table border="0" cellspacing="2" cellpadding="0">
- <tr><td valign="top"></td><td valign="top"><em>t</em> </td><td>A pointer to the timer.</td></tr>
- </table>
- </dl>
- <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a00156.html#gcb807bd57e5489b386b876af5c1f163a">timer_restart()</a> </dd></dl>
- <dl compact><dt><b>Examples: </b></dt><dd>
- <a class="el" href="a00042.html#a78">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a95">example-mainloop-without-arp.c</a>.</dl>
- <p>
- Definition at line <a class="el" href="a00195.html#l00084">84</a> of file <a class="el" href="a00195.html">timer.c</a>.
- <p>
- References <a class="el" href="a00196.html#l00076">interval</a>, and <a class="el" href="a00196.html#l00075">start</a>. </td>
- </tr>
- </table>
- <a class="anchor" name="gcb807bd57e5489b386b876af5c1f163a"></a><!-- doxytag: member="timer.h::timer_restart" ref="gcb807bd57e5489b386b876af5c1f163a" args="(struct timer *t)" --><p>
- <table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">void timer_restart </td>
- <td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">struct <a class="el" href="a00087.html">timer</a> * </td>
- <td class="mdname1" valign="top" nowrap> <em>t</em> </td>
- <td class="md" valign="top"> ) </td>
- <td class="md" nowrap></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
- <p>
- Restart the timer from the current point in time.
- <p>
- This function restarts a timer with the same interval that was given to the <a class="el" href="a00156.html#g6614d96fdfcd95c95ec6e6f63071ff51">timer_set()</a> function. The timer will start at the current time.<p>
- <dl compact><dt><b>Note:</b></dt><dd>A periodic timer will drift if this function is used to reset it. For preioric timers, use the <a class="el" href="a00156.html#gedaf3e48c2b04229b85455fb948468d6">timer_reset()</a> function instead.</dd></dl>
- <dl compact><dt><b>Parameters:</b></dt><dd>
- <table border="0" cellspacing="2" cellpadding="0">
- <tr><td valign="top"></td><td valign="top"><em>t</em> </td><td>A pointer to the timer.</td></tr>
- </table>
- </dl>
- <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a00156.html#gedaf3e48c2b04229b85455fb948468d6">timer_reset()</a> </dd></dl>
- <p>
- Definition at line <a class="el" href="a00195.html#l00104">104</a> of file <a class="el" href="a00195.html">timer.c</a>.
- <p>
- References <a class="el" href="a00157.html#ge5b7160f2e653725ba5e2024c3cb7bff">clock_time()</a>, and <a class="el" href="a00196.html#l00075">start</a>. </td>
- </tr>
- </table>
- <a class="anchor" name="g6614d96fdfcd95c95ec6e6f63071ff51"></a><!-- doxytag: member="timer.h::timer_set" ref="g6614d96fdfcd95c95ec6e6f63071ff51" args="(struct timer *t, clock_time_t interval)" --><p>
- <table class="mdTable" cellpadding="2" cellspacing="0">
- <tr>
- <td class="mdRow">
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td class="md" nowrap valign="top">void timer_set </td>
- <td class="md" valign="top">( </td>
- <td class="md" nowrap valign="top">struct <a class="el" href="a00087.html">timer</a> * </td>
- <td class="mdname" nowrap> <em>t</em>, </td>
- </tr>
- <tr>
- <td class="md" nowrap align="right"></td>
- <td class="md"></td>
- <td class="md" nowrap>clock_time_t </td>
- <td class="mdname" nowrap> <em>interval</em></td>
- </tr>
- <tr>
- <td class="md"></td>
- <td class="md">) </td>
- <td class="md" colspan="2"></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <table cellspacing="5" cellpadding="0" border="0">
- <tr>
- <td>
-
- </td>
- <td>
- <p>
- Set a timer.
- <p>
- This function is used to set a timer for a time sometime in the future. The function <a class="el" href="a00156.html#g6d71dececfce707c668e6257aad5906e">timer_expired()</a> will evaluate to true after the timer has expired.<p>
- <dl compact><dt><b>Parameters:</b></dt><dd>
- <table border="0" cellspacing="2" cellpadding="0">
- <tr><td valign="top"></td><td valign="top"><em>t</em> </td><td>A pointer to the timer </td></tr>
- <tr><td valign="top"></td><td valign="top"><em>interval</em> </td><td>The interval before the timer expires. </td></tr>
- </table>
- </dl>
- <dl compact><dt><b>Examples: </b></dt><dd>
- <a class="el" href="a00048.html#a22">dhcpc.c</a>, <a class="el" href="a00042.html#a62">example-mainloop-with-arp.c</a>, and <a class="el" href="a00043.html#a86">example-mainloop-without-arp.c</a>.</dl>
- <p>
- Definition at line <a class="el" href="a00195.html#l00064">64</a> of file <a class="el" href="a00195.html">timer.c</a>.
- <p>
- References <a class="el" href="a00157.html#ge5b7160f2e653725ba5e2024c3cb7bff">clock_time()</a>, <a class="el" href="a00196.html#l00076">interval</a>, and <a class="el" href="a00196.html#l00075">start</a>. </td>
- </tr>
- </table>
- <hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by
- <a href="http://www.doxygen.org/index.html">
- <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
- </body>
- </html>
|