#include "time.hpp" #include Time::Time(uint64_t time_micros) : _time_micros(time_micros) { } void Time::update() { _time_micros = micros(); } Time Time::diff(Time prev_time) { return Time(_time_micros - prev_time.microsecs()); } double Time::secs() { const double micros_to_secs = 0.000001; return static_cast(_time_micros) * micros_to_secs; } double Time::millisecs() { const double micros_to_millis = 0.001; return static_cast(_time_micros) * micros_to_millis; } uint64_t Time::microsecs() { return _time_micros; } Time time_now() { return Time(micros()); }