aboutsummaryrefslogtreecommitdiff
path: root/src/timer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/timer.cc')
-rw-r--r--src/timer.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/timer.cc b/src/timer.cc
new file mode 100644
index 0000000..c46017c
--- /dev/null
+++ b/src/timer.cc
@@ -0,0 +1,16 @@
+#include "timer.h"
+
+namespace timer {
+
+std::chrono::time_point<std::chrono::high_resolution_clock> now() {
+ return std::chrono::high_resolution_clock::now();
+}
+
+double millisecondsSince(
+ std::chrono::time_point<std::chrono::high_resolution_clock>& pit) {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(
+ now() - pit
+ ).count();
+}
+
+}