#include <Timer.h>
Public Member Functions | |
Timer () | |
double | Get () |
void | Reset () |
void | Start () |
void | Stop () |
bool | HasPeriodPassed (double period) |
Static Public Member Functions | |
static double | GetFPGATimestamp () |
static double | GetPPCTimestamp () |
Timer objects measure accumulated time in seconds. The timer object functions like a stopwatch. It can be started, stopped, and cleared. When the timer is running its value counts up in seconds. When stopped, the timer holds the current value. The implementation simply records the time when started and subtracts the current time whenever the value is requested.
Timer::Timer | ( | ) |
double Timer::Get | ( | ) |
Get the current time from the timer. If the clock is running it is derived from the current system clock the start time stored in the timer class. If the clock is not running, then return the time when it was last stopped.
bool Timer::HasPeriodPassed | ( | double | period | ) |
Check if the period specified has passed and if it has, advance the start time by that period. This is useful to decide if it's time to do periodic work without drifting later by the time it took to get around to checking.
period | The period to check for (in seconds). |
void Timer::Reset | ( | ) |
void Timer::Start | ( | ) |
void Timer::Stop | ( | ) |