0
time_t start = time(0);
double seconds = difftime( time(0), start);
cout <<"Seconds =" <<seconds<<endl;

The above code generate result in seconds (1,2, 3, 4...). It is possible to generate in 0.1 seconds or 0.01seconds?

Lim.Chiung
  • 19
  • 5
  • 1
    C++11 Chrono library, http://en.cppreference.com/w/cpp/chrono, and specifically high_resolution_clock, http://en.cppreference.com/w/cpp/chrono/high_resolution_clock. Timepoint, http://en.cppreference.com/w/cpp/chrono/time_point, has a good example of how to use the clock to time something. – user4581301 May 10 '16 at 04:58
  • See here: http://stackoverflow.com/questions/307596/time-difference-in-c – Ton Plooij May 10 '16 at 05:35

0 Answers0