Squashed 'third_party/Phoenix-frc-lib/' content from commit 666d176
Change-Id: Ibaca2fc8ffb1177e786576cc1e4cc9f7a8c98f13
git-subtree-dir: third_party/Phoenix-frc-lib
git-subtree-split: 666d176a08151793044ab74e0005f13d3732ed96
diff --git a/cpp/src/Stopwatch.cpp b/cpp/src/Stopwatch.cpp
new file mode 100644
index 0000000..522965b
--- /dev/null
+++ b/cpp/src/Stopwatch.cpp
@@ -0,0 +1,20 @@
+#include "ctre/phoenix/Stopwatch.h"
+
+namespace ctre {
+namespace phoenix {
+
+void Stopwatch::Start(){
+ _t0 = (float)clock();
+}
+unsigned int Stopwatch::DurationMs(){
+ return Stopwatch::Duration() * 1000;
+}
+float Stopwatch::Duration(){
+ _t1 = (float)clock();
+ long retval = _t1 - _t0;
+ if(retval < 0) retval = 0;
+ return retval * _scalar;
+}
+
+} // namespace phoenix
+}