1 #ifndef UTIL_CLOCK_MAN_CLOCK_CLIB_H_INCLUDED
2 #define UTIL_CLOCK_MAN_CLOCK_CLIB_H_INCLUDED
37 typedef std::chrono::milliseconds duration;
38 typedef duration::rep rep;
39 typedef duration::period period;
40 typedef std::chrono::time_point<ClockCLib, duration> time_point;
42 static time_point now()
44 std::clock_t t = std::clock();
45 if ( static_cast<std::clock_t>(-1) == t ) {
46 throw std::runtime_error(
"Error in ClockCLib");
49 constexpr
double conv = 1.0 / CLOCKS_PER_SEC;
50 constexpr
double ratio =
static_cast<double>(period::den)/static_cast<double>(period::num);
51 const duration d(static_cast<rep>(static_cast<double>(t) * conv * ratio));
59 #endif // end of include guard
Namespace for the core simulator.
Clock based on C library clock_t clock() which returns an approximate processor time in ticks...