title: C error: storage size isn’t known
body: <p>I wanna run Thimoty's Rolfe implementation of mergesort in MPI, but to get it working I need to compile this wallClock.c file that he provides.</p>
  
  <pre><code>#include &lt;time.h&gt;
  
  
  double wallClock(void)
  {
     struct timeval tv;
     double current;
  
     gettimeofday(&amp;tv, NULL);   // Omit the timezone struct
     current = tv.tv_sec + 1.0e-06 * tv.tv_usec;
  
     return current;
  }
  </code></pre>
  
  <p>When compiling I get the following error:</p>
  
  <pre><code>wallClock.c:12: error: storage size of ‘tv’ isn’t known
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p>btw, I changed his <code>#include &lt;sys/time.h&gt;</code> to  <code>#include &lt;time.h&gt;</code></p>
  
  <p>it  generated the following errors</p>
  
  <pre><code>wallClock.c:15: error: ‘NULL’ undeclared (first use in this function)
  wallClock.c:15: error: (Each undeclared identifier is reported only once
  wallClock.c:15: error: for each function it appears in.)
  </code></pre>
  
  <p>I tried including stdlib.h (to fix the NULL undeclared one) and got even more obscure errors.</p>