WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Timer.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef TIMER_H_
8 #define TIMER_H_
9 
10 #include "semLib.h"
11 #include "Base.h"
12 
13 typedef void (*TimerInterruptHandler)(void *param);
14 
15 void Wait(double seconds);
16 double GetClock();
17 double GetTime();
18 
19 
27 class Timer
28 {
29 public:
30  Timer();
31  virtual ~Timer();
32  double Get();
33  void Reset();
34  void Start();
35  void Stop();
36  bool HasPeriodPassed(double period);
37 
38  static double GetFPGATimestamp();
39  static double GetPPCTimestamp();
40 
41 private:
42  double m_startTime;
43  double m_accumulatedTime;
44  bool m_running;
45  SEM_ID m_semaphore;
46  DISALLOW_COPY_AND_ASSIGN(Timer);
47 };
48 
49 #endif
bool HasPeriodPassed(double period)
Definition: Timer.cpp:158
double Get()
Definition: Timer.cpp:85
void Stop()
Definition: Timer.cpp:138
Timer()
Definition: Timer.cpp:61
void Start()
Definition: Timer.cpp:122
void Reset()
Definition: Timer.cpp:110
Definition: Timer.h:27