#include #include "tictoc.h" static struct timespec tic_start; void tic(){ clock_gettime(CLOCK_MONOTONIC_RAW,&tic_start); } double toc(){ struct timespec tic_stop; clock_gettime(CLOCK_MONOTONIC_RAW,&tic_stop); double sec=tic_stop.tv_sec-tic_start.tv_sec; return sec+(tic_stop.tv_nsec-tic_start.tv_nsec)*1.0e-9; }