Brian Silverman | 890a32a | 2018-03-11 15:41:56 -0700 | [diff] [blame] | 1 | #include "ctre/phoenix/Stopwatch.h" |
2 | |||||
3 | namespace ctre { | ||||
4 | namespace phoenix { | ||||
5 | |||||
6 | void Stopwatch::Start(){ | ||||
7 | _t0 = (float)clock(); | ||||
8 | } | ||||
9 | unsigned int Stopwatch::DurationMs(){ | ||||
10 | return Stopwatch::Duration() * 1000; | ||||
11 | } | ||||
12 | float Stopwatch::Duration(){ | ||||
13 | _t1 = (float)clock(); | ||||
14 | long retval = _t1 - _t0; | ||||
15 | if(retval < 0) retval = 0; | ||||
16 | return retval * _scalar; | ||||
17 | } | ||||
18 | |||||
19 | } // namespace phoenix | ||||
20 | } |