summaryrefslogtreecommitdiff
path: root/src/helpers/Timer.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-24 23:27:02 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-24 23:27:02 +0200
commit72c86b99eb87b23c11fdc795ec6f3668f283b95c (patch)
tree2d612e505a465b29f2d95a500d77a2f91485ea50 /src/helpers/Timer.cpp
parenteb13be1240dfe83b42e26621069aeb09ecf39b66 (diff)
added general:cursor_inactive_timeout
Diffstat (limited to 'src/helpers/Timer.cpp')
-rw-r--r--src/helpers/Timer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/helpers/Timer.cpp b/src/helpers/Timer.cpp
new file mode 100644
index 00000000..33162d30
--- /dev/null
+++ b/src/helpers/Timer.cpp
@@ -0,0 +1,17 @@
+#include "Timer.hpp"
+
+void CTimer::reset() {
+ m_tpLastReset = std::chrono::system_clock::now();
+}
+
+std::chrono::system_clock::duration CTimer::getDuration() {
+ return std::chrono::system_clock::now() - m_tpLastReset;
+}
+
+int CTimer::getMillis() {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count();
+}
+
+float CTimer::getSeconds() {
+ return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count() / 1000.f;
+} \ No newline at end of file