Apr 20, 2012 at 4:06pm UTC
I want to measure the time of a call duration but i dont know how to do it. Please help me.
Apr 20, 2012 at 4:33pm UTC
explain your problem by jxt giving a sample run what u actually want?
Apr 20, 2012 at 4:40pm UTC
This is the code that I got but it has some errors and not running. Also i want to use <chrono>, which people say is advance but i have no clue as to how we will use it? Can you help me??
double diffclock(double clock_t clock1,double clock_t clock2)
int main ()
cout << "Hi what is your name? ";
cout << "Time elapsed: " << double(diffclock(end,begin)) << " ms"<< endl;
Last edited on
Apr 20, 2012 at 4:42pm UTC
Apr 20, 2012 at 4:58pm UTC
Could you tell me how would you use <chrono> to get the time differnece between a phone call being made as an example?
Apr 21, 2012 at 4:06am UTC
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include <chrono>
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now() ;
// the operation to time (for elapsed time)
char ch ; std::cout << '?' && std::cin >> ch ;
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now() ;
typedef std::chrono::duration< int,std::milli> millisecs_t ;
millisecs_t duration( std::chrono::duration_cast<millisecs_t>(end-start) ) ;
std::cout << duration.count() << " milliseconds.\n" ;
> The C library clock() function only has a second resolution.
The C library clock() function has an implementation defined
measures the approximate processor time used, and not the elapsed time.
Last edited on
Apr 21, 2012 at 4:14am UTC