04-19-2012 07:12 AM
struct timespec start, stop;
if(clock_gettime( CLOCK_REALTIME, &start) == -1)
{
fprintf(stderr, "ERROR GETTING TIME");
}
... long execution ...
if(clock_gettime( CLOCK_REALTIME, &stop) == -1)
{
fprintf(stderr, "ERROR GETTING TIME2");
}
fprintf(stderr, "Time: %f", (double)( stop.tv_nsec - start.tv_nsec ) / (double)1000000000.0F);
Using this to surround something that's taking about 3 seconds to execute is resulting in output such as:
Time: -0.743363
What gives?
Solved! Go to Solution.
04-19-2012 07:57 AM
04-19-2012 08:04 AM
Ah yes. You are exactly right. Thanks!
04-19-2012 08:36 AM - edited 04-19-2012 08:37 AM
You could also give a try to Qt for Playbook :-) It's better portable (Windows/Linux/Symbian/Meego+++), easy to use, well documented etc. Qt for Playbook is alpha or beta, but most things are running fluently and Cascades will be build upon it (as I understand the things). Here is the Code for Qt:
QTimer timer; timer.start(); ... long operation timer.elapsed();