Does anyone know how to calculate time difference in C++ in milliseconds?
I used difftime
but it doesn't have enough precision for what I'm trying to measure.
C++ – Calculating Time Difference
c++time
c++time
Does anyone know how to calculate time difference in C++ in milliseconds?
I used difftime
but it doesn't have enough precision for what I'm trying to measure.
Best Answer
I know this is an old question, but there's an updated answer for C++0x. There is a new header called
<chrono>
which contains modern time utilities. Example use:More information can be found here:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm
There is also now a boost implementation of
<chrono>
.