Skip to content

Instantly share code, notes, and snippets.

@VictorSouzas
Created March 22, 2017 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VictorSouzas/e6415093a5bf1f167b132140df2e685f to your computer and use it in GitHub Desktop.
Save VictorSouzas/e6415093a5bf1f167b132140df2e685f to your computer and use it in GitHub Desktop.
#include <sys/times.h>
struct timeval tv1, tv2;
#define TIMER_CLEAR (tv1.tv_sec = tv1.tv_usec = tv2.tv_sec = tv2.tv_usec=0)
#define TIMER_START gettimeofday(&tv1, (struct timezone*)0)
#define TIMER_STOP gettimeofday(&tv2, (struct timezone*)0)
#define TIMER_ELAPSED (tv2.tv_sec-tv1.tv_sec+(tv2.tv_usec-tv1.tv_usec)*1.E-6)
#include <sys/times.h>
struct timeval tv1, tv2;
#define TIMER_CLEAR (tv1.tv_sec = tv1.tv_usec = tv2.tv_sec = tv2.tv_usec=0)
#define TIMER_START gettimeofday(&tv1, (struct timezone*)0)
#define TIMER_STOP gettimeofday(&tv2, (struct timezone*)0)
#define TIMER_ELAPSED (tv2.tv_sec-tv1.tv_sec+(tv2.tv_usec-tv1.tv_usec)*1.E-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment