2020-11-30 16:35:06 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "efitime.h"
|
|
|
|
|
|
|
|
class Timer {
|
|
|
|
public:
|
|
|
|
void reset();
|
2020-12-03 08:13:45 -08:00
|
|
|
|
|
|
|
// Reset the timer to a known timestamp (don't take a timestamp internally)
|
|
|
|
void reset(efitick_t nowNt);
|
|
|
|
|
2020-11-30 16:35:06 -08:00
|
|
|
bool hasElapsedSec(float seconds) const;
|
|
|
|
bool hasElapsedMs(float ms) const;
|
|
|
|
bool hasElapsedUs(float us) const;
|
|
|
|
|
2020-12-03 08:13:45 -08:00
|
|
|
// Return the elapsed time since the last reset.
|
|
|
|
// If the elapsed time is longer than 2^32 timer tick counts,
|
|
|
|
// then a time period representing 2^32 counts will be returned.
|
|
|
|
float getElapsedSeconds() const;
|
|
|
|
|
2020-11-30 16:35:06 -08:00
|
|
|
private:
|
|
|
|
efitick_t m_lastReset = INT64_MIN;
|
|
|
|
};
|