[C++] Tic Toc function (Matlab-style)

  1. double tt_tic=0;
  2. void tic(){
  3. 	tt_tic = getTickCount();
  4. }
  5. void toc(){
  6. 	double tt_toc = (getTickCount() - tt_tic)/(getTickFrequency());
  7. 	printf ("toc: %4.3f sn", tt_toc);
  8. }
seriously, if you Google for “tic toc c++” you will get people writing on for ages in which way you can do this, instead of just posting the code. So here it is. TADAA! Matlab-style tictoc functionality! You request it in your code (duh) just by stating “tic();” and then “toc();”. Also, all my code is licenced under a Creative Commons licence. This code on the other hand I have licenced under a beerware licence (http://en.wikipedia.org/wiki/Beerware). Just so you know.]]>

You may also like...

1 Response

  1. MRM says:

    Thanx man. You are my hero:)