shoosh shoosh - 1 year ago 250
C++ Question

Get elapsed time in Qt

I'm looking for the equivalent in Qt to


Something that will allow me to measure the time it takes for a segment of code to run as in:

uint start = GetTickCount();
// do something..
uint timeItTook = GetTickCount() - start;

any suggestions?

Answer Source

How about QTime? Depending on your platform it should have 1 millisecond accuracy. Code would look something like this:

QTime myTimer;
// do something..
int nMilliseconds = myTimer.elapsed();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download