Time measure method
Posted by Unknown in Complexity on 2009/10/23
#include< iostream >
#include< ctime >
using namespace std;
int main(void)
{
//clock_t = long
const clock_t START = clock();
clock_t sleeptime = clock() + 3*CLOCKS_PER_SEC;
//sleep three seconds
while(clock()< sleeptime) ;
cout<< (clock()-START )/CLOCKS_PER_SEC<<" sec"<< endl;
return 0;
}
This entry was posted on 2009/10/23 at 下午1:53 and is filed under Complexity. You can follow any responses to this entry through the RSS 2.0. You can leave a response.
- No comments yet.