Time difference between clock() time in c++ and System.CurrentTimeMillis() in java
<p><strong>What i do:</strong></p>

<p>1.I called a c++ method from java by generating wrapper using the swig intermediate file.</p>

<p>2.I used clock() time inside c++ code, to calculate the total time taken in the method writtern in c++(Differnce from start to end) .</p>

<pre><code>       clock_t start=clock();
       clock_t end=clock();
       double elapsed_secs = double(end - start) / (CLOCKS_PER_SEC)*1000;
</code></pre>

<p>3.In the java, i used <strong><em>System.CurrentTimeMillis()</em></strong> to calculate the time taken to call the method.</p>

<p><strong>What i have to know:</strong></p>

<p>When calculating the both difference in milliseconds,it was found that the time difference taken inside the c++ is more than the time difference while calling the method in java.</p>

<p>1.How the time taken while calling the method from java is less than the toatal time taken inside the method?</p>

<p>2.Is there any difference between the clock() time and the System.CurrentTimeMillis()?</p>