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++ – Time difference in C++
c++time
Related Question
- Python – How to get the current time in Python
- Unix – What do ‘real’, ‘user’ and ‘sys’ mean in the output of time(1)
- C++ – Easily measure elapsed time
- C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming
- C++ – C++ programmers minimize use of ‘new’
- C++ – the difference between ‘typedef’ and ‘using’ in C++11
- C++ – Why is the program slow when looping over exactly 8192 elements
- C++ – Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviations with _mm_popcnt_u64 on Intel CPUs
Best Solution
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>
.