title: resolving redefinition of timespec in time.h
body: <p>I am writing a program which includes both <code>/usr/include/linux/time.h</code> and <code>/usr/include/stdlib.h.</code></p>
  
  <p>The problem is: </p>
  
  <p><code>stdlib.h</code> includes <code>/usr/include/time.h</code>, which defines '<code>struct timespec'</code>, and <code>/usr/include/linux/time.h</code> also defines one. This introduces a compilation error of redefinition.</p>
  
  <p>I've examined the definitions of <code>'struct timespec'</code> in these two header files:</p>
  
  <p>in /usr/include/time.h:</p>
  
  <pre><code>struct timespec
  {
      __time_t tv_sec;            /* Seconds.  */
      long int tv_nsec;           /* Nanoseconds.  */
  };
  </code></pre>
  
  <p>in /usr/include/linux/time.h:</p>
  
  <pre><code>struct timespec {
      __kernel_time_t tv_sec;                 /* seconds */
      long            tv_nsec;                /* nanoseconds */
  }; 
  </code></pre>
  
  <p>It seems that these definitions are indeed equivalent, but I can't prove it.</p>
  
  <p>My question is: is there a robust way to resolve this redefinition?</p>
  
  <p>Links to discussions on this problem are also highly appreciated. Thanks.</p>