Commit 957eb9a9 authored by Thiago Santini's avatar Thiago Santini

Adds missing file

parent 513c2640
#ifndef MONOTONICCLOCK_H
#define MONOTONICCLOCK_H
#include <chrono>
using Timestamp = double;
using SteadyTimePoint = std::chrono::time_point<std::chrono::steady_clock>;
class MonotonicClock {
public:
MonotonicClock()
: started(now())
{
}
static SteadyTimePoint now() { return std::chrono::steady_clock::now(); }
Timestamp elapsed() const
{
return 1e-6 * std::chrono::duration_cast<std::chrono::nanoseconds>(now() - started).count();
}
Timestamp elapsed(const SteadyTimePoint& p) const
{
return 1e-6 * std::chrono::duration_cast<std::chrono::nanoseconds>(p - started).count();
}
private:
const SteadyTimePoint started;
};
using ReferenceClock = MonotonicClock;
#endif // MONOTONICCLOCK_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment