[ milli | micro | nano ]second granularity using tv_usec or tv_nsec
<p>I'm working on a project, and I need to need a finer granularity than whole second (i.e. time()). I was looking through opengroup.org and I notice there are data structures with memebers tv_usec and tv_nsec.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;time.h&gt;

int main (void) {
      struct timespec ts;
      clock_gettime(CLOCK_REALTIME, &amp;ts);
      printf("%lis %lins\n", ts.tv_sec, ts.tv_nsec);

      return 0;
}


test.cpp(5) : error C2079: 'ts' uses undefined struct 'main::timespec'
test.cpp(6) : error C2065: 'CLOCK_REALTIME' : undeclared identifier
test.cpp(6) : error C3861: 'clock_gettime': identifier not found
</code></pre>

<p>Is there an easy way to get a high precision time value by using the standard lib? I don't actually need high accuracy, but I do need increments for relative time.</p>
