[C++] Tic Toc function (Matlab-style)
This needs to introduction. While drinking milk i finally figured out the holy grail of C++, possibly the most universal and useful function i have ever written in any language. It formulates itself in practically three lines of code. Put the following outside the main():
tt_tic = getTickCount();
double tt_toc = (getTickCount() - tt_tic)/(getTickFrequency());
printf ("toc: %4.3f sn", tt_toc);
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.