root/timer.cc

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. reset_timer
  2. get_time

#include<ctime>
#include "timer.h"

timespec start_time;

void reset_timer(){
  clock_gettime(TIMER_TYPE, &start_time);
}

double get_time(){
  timespec t;
  clock_gettime(TIMER_TYPE, &t);
  return double(t.tv_sec - start_time.tv_sec) + double(t.tv_nsec - start_time.tv_nsec) * 1.e-9;
}

/* [<][>][^][v][top][bottom][index][help] */