title: how to calculate milliseconds using timeval structure?
body: <p>I want to retrieve values in milliseconds from a variable of type timeval. Below is my attempt:</p>
  
  <pre><code>timeval* time;
  long int millis = (time-&gt;tv_sec * 1000) + (time-&gt;tv_usec / 1000);
  printf("Seconds : %ld, Millis : %ld", time-&gt;tv_sec, millis);
  
  Output =&gt; Seconds : 1378441469, Millis : -243032358
  </code></pre>
  
  <p>Issue is I am getting millisecond values in minus. What is wrong with this snippets?</p>