diff options
| author | xDarksome <dev@darkso.me> | 2022-06-26 19:20:20 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-26 19:20:20 +0300 |
| commit | 504f76112aec3625f2d67f9289a48a01bc90cb50 (patch) | |
| tree | f3a4c5176a2d8f1954a7632b542f829e994c8529 /src/helpers/Timer.cpp | |
| parent | be460ea9547691eb136bf8b600b67b778af47e3f (diff) | |
| parent | f1a5cb4979f312f56967888c2b1b6d2aa535bb9e (diff) | |
Merge branch 'hyprwm:main' into main
Diffstat (limited to 'src/helpers/Timer.cpp')
| -rw-r--r-- | src/helpers/Timer.cpp | 17 |
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 |
