#include "time.hpp" #include namespace common { Time::Time(uint64_t time_micros) : _time_micros(time_micros) { } void Time::update() { _time_micros = micros(); } Time Time::diff(Time prev_time) const { return Time(_time_micros - prev_time.microsecs()); } double Time::secs() const { return static_cast(_time_micros) * MICROS_TO_SECS; } double Time::millisecs() const { return static_cast(_time_micros) * MICROS_TO_MILLIS; } uint64_t Time::microsecs() const { return _time_micros; } Time time_now() { return Time(micros()); } } // namespace common