summaryrefslogtreecommitdiff
path: root/src/protocols/Screencopy.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-04-16 01:37:48 +0100
committerVaxry <vaxry@vaxry.net>2025-04-16 01:37:48 +0100
commit877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac (patch)
tree5b52ad19c695590ae50c7adae06b8e3aeccf34c1 /src/protocols/Screencopy.cpp
parent0e521788bcc414c9cf81648d3167757d83deb60f (diff)
time: move to stl's clocks and move timer
Diffstat (limited to 'src/protocols/Screencopy.cpp')
-rw-r--r--src/protocols/Screencopy.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index d5a5f816..11aa5957 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -11,6 +11,7 @@
#include "types/WLBuffer.hpp"
#include "types/Buffer.hpp"
#include "../helpers/Format.hpp"
+#include "../helpers/time/Time.hpp"
#include <algorithm>
#include <functional>
@@ -166,10 +167,9 @@ void CScreencopyFrame::share() {
if (!buffer || !pMonitor)
return;
- timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
+ const auto NOW = Time::steadyNow();
- auto callback = [this, now, weak = self](bool success) {
+ auto callback = [this, NOW, weak = self](bool success) {
if (weak.expired())
return;
@@ -185,9 +185,11 @@ void CScreencopyFrame::share() {
resource->sendDamage(0, 0, buffer->size.x, buffer->size.y);
}
- uint32_t tvSecHi = (sizeof(now.tv_sec) > 4) ? now.tv_sec >> 32 : 0;
- uint32_t tvSecLo = now.tv_sec & 0xFFFFFFFF;
- resource->sendReady(tvSecHi, tvSecLo, now.tv_nsec);
+ const auto [sec, nsec] = Time::secNsec(NOW);
+
+ uint32_t tvSecHi = (sizeof(sec) > 4) ? sec >> 32 : 0;
+ uint32_t tvSecLo = sec & 0xFFFFFFFF;
+ resource->sendReady(tvSecHi, tvSecLo, nsec);
};
if (bufferDMA)