From 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 16 Apr 2025 01:37:48 +0100 Subject: time: move to stl's clocks and move timer --- src/protocols/GlobalShortcuts.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/protocols/GlobalShortcuts.cpp') diff --git a/src/protocols/GlobalShortcuts.cpp b/src/protocols/GlobalShortcuts.cpp index 9f8f422c..04e4e091 100644 --- a/src/protocols/GlobalShortcuts.cpp +++ b/src/protocols/GlobalShortcuts.cpp @@ -1,4 +1,5 @@ #include "GlobalShortcuts.hpp" +#include "../helpers/time/Time.hpp" CShortcutClient::CShortcutClient(SP resource_) : resource(resource_) { if UNLIKELY (!good()) @@ -68,14 +69,13 @@ void CGlobalShortcutsProtocol::sendGlobalShortcutEvent(std::string appid, std::s for (auto const& c : m_vClients) { for (auto const& sh : c->shortcuts) { if (sh->appid == appid && sh->id == trigger) { - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - uint32_t tvSecHi = (sizeof(now.tv_sec) > 4) ? now.tv_sec >> 32 : 0; - uint32_t tvSecLo = now.tv_sec & 0xFFFFFFFF; + const auto [sec, nsec] = Time::secNsec(Time::steadyNow()); + uint32_t tvSecHi = (sizeof(sec) > 4) ? sec >> 32 : 0; + uint32_t tvSecLo = sec & 0xFFFFFFFF; if (pressed) - sh->resource->sendPressed(tvSecHi, tvSecLo, now.tv_nsec); + sh->resource->sendPressed(tvSecHi, tvSecLo, nsec); else - sh->resource->sendReleased(tvSecHi, tvSecLo, now.tv_nsec); + sh->resource->sendReleased(tvSecHi, tvSecLo, nsec); } } } -- cgit v1.2.3