Add gettimeofday()

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1974 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-07-11 23:39:33 +00:00
parent b46074d348
commit 46e7e2d918
2 changed files with 30 additions and 0 deletions

View File

@ -1481,6 +1481,8 @@ nuttx-0.4.10 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
* lib/: Greatly simplified mktime() and gmtime_r(). The Gregorian and
Julian time calculations were interesting, but not necessary in the
typical embeddd system.
* sched/: Added gettimeofday(). This implementation is simply a thin
wrapper around clock_gettimer().
nuttx-0.4.10 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>

View File

@ -2469,6 +2469,7 @@ VxWorks provides the following comparable interface:
<li><a href="#timersettime">2.7.9 timer_settime</a></li>
<li><a href="#timergettime">2.7.10 timer_gettime</a></li>
<li><a href="#timergetoverrun">2.7.11 timer_getoverrun</a></li>
<li><a href="#gettimeofday">2.7.12 gettimeofday</a></li>
</ul>
<H3><a name="clocksettime">2.7.1 clock_settime</a></H3>
@ -2917,6 +2918,33 @@ VxWorks provides the following comparable interface:
interface of the same name.
</p>
<h3><a name="gettimeofday">2.7.12 gettimeofday</a></h3>
<p>
<b>Function Prototype:</b>
</p>
<pre>
#include &lt;sys/time.h&gt;
int gettimeofday(struct timeval *tp, void *tzp);
</pre>
<p>
<b>Description:</b>
This implementation of <code>gettimeofday()</code> is simply a thin wrapper around
<a href="#clockgettime"><code>clock_gettime()</code></a>.
It simply calls <code>clock_gettime()</code> using the <code>CLOCK_REALTIME</code> timer and
converts the result to the required <code>struct timeval</code>.
</p>
<p>
<b>Input Parameters:</b>
</p>
<ul>
<li><code>tp</code>. The current time will be returned to this user provided location.</li>
<li><code>tzp</code>. A reference to the timezone -- <i>IGNORED</i>.</li>
</ul>
<p>
<b>Returned Values:</b>
See <a href="#clockgettime"><code>clock_gettime()</code></a>.
</p>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>