1 #ifndef _SPICA_TIMER_H_
2 #define _SPICA_TIMER_H_
4 #if __cplusplus > 199711L
6 typedef std::chrono::time_point<std::chrono::system_clock> time_type;
7 inline time_type tick() {
8 return std::chrono::system_clock::now();
10 inline double to_duration(time_type start, time_type end) {
11 return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / 1000.0;
15 typedef clock_t time_type;
16 inline time_type tick() {
19 inline double to_duration(time_type start, time_type end) {
20 return (end - start) / 1000.0;
44 return to_duration(_start, _end);
49 #endif // _SPICA_TIMER_H_