72 return static_cast<int>(p);
80 static const double precision_values[];
86 return clock_t::now();
101 duration_t et = std::chrono::duration_cast<std::chrono::nanoseconds>
103 return et.count() * precision_values[
to_int(precision)];
118 Now(
bool start_now =
false)
138 : tp(), precision(_precision)
159 precision = _precision;
Now(bool start_now=false)
Builds a new object with default values.
Definition: now.H:118
static double elapsed(const time_point_t &tp, const Precision &precision=Precision::MILLISECONDS)
Definition: now.H:211
clock_t::duration duration_t
Definition: types.H:56
double delta()
Definition: now.H:195
static double compute_time_diff(const time_point_t &rtp, const time_point_t <p, const Precision &precision)
Definition: now.H:97
static int to_int(Precision p)
Definition: now.H:70
Precision
Precision for timing.
Definition: now.H:60
Now(const Precision &_precision, bool start_now=false)
Builds a new object with parametric precision time.
Definition: now.H:137
const Precision & get_precision() const
Definition: now.H:148
double elapsed()
Definition: now.H:184
clock_t::time_point time_point_t
Definition: types.H:55
static double delta(const time_point_t &tp, const Precision &precision=Precision::MILLISECONDS)
Definition: now.H:223
time_point_t start()
Definition: now.H:170
static time_point_t current_time_point()
Gets the current time point.
Definition: now.H:84
void set_precision(const Precision &_precision)
Definition: now.H:157