visual c++ - Simple time tracker in C++ -


this question has answer here:

im new c++ , wondering how go implementing simple timer keeps track of how time has passed while program running. eg how know when 300 seconds has passed?

#include <time.h>    clock_t t1,t2;  t1 = clock();   //your code here  t2 = clock();  //time taken running code segment double time_dif = (double)(t2 - t1)/clocks_per_sec; 

actually t1-t2 gives number of total clock cycles during execution, divide clocks_per_sec actual time


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -