timer.hh 393 Bytes
Newer Older
Rick Ho's avatar
Rick Ho committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef TIMER_HH
#define TIMER_HH

#include <chrono>

inline double getDuration(std::chrono::time_point<std::chrono::system_clock> a,
		                    std::chrono::time_point<std::chrono::system_clock> b) {
	      return  std::chrono::duration<double>(b - a).count();
}

#define timestamp(__var__) auto __var__ = std::chrono::system_clock::now();

#include <chrono>

#endif  // TIMER_HH