title: How to Get system clock in microseconds in C++?
body: <p>I am working on a project using Visual C++ /CLR in console mode.
  How can I get the system clock in microseconds ?
  I want to display <code>hours:minutes:seconds:microseconds</code></p>
  
  <p>The following program works well but is not compatible with other platforms:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;sys/time.h&gt;
  int main()
  {
       struct timeval tv;
       struct timezone tz;
       struct tm *tm;
       gettimeofday(&amp;tv, &amp;tz);
       tm=localtime(&amp;tv.tv_sec);
       printf(" %d:%02d:%02d %ld \n", tm-&gt;tm_hour, tm-&gt;tm_min,tm-&gt;tm_sec, tv.tv_usec);
       return 0;
  }
  </code></pre>