This will show how many seconds:
#include <iostream> #include <time.h> using namespace std; int main(void) { int times,timed; times=time(NULL); //CODE HERE timed=time(NULL); times=timed-times; cout << "time from start to end" << times; }
This will show how many ticks:
#include <iostream> #include <time.h> using namespace std; int main(void) { int times,timed; times=clock(); //CODE HERE timed=clock(); times=timed-times; cout << "ticks from start to end" << times; }
How to get milliseconds?
source share