From 5309e6d94a436dad9f1f357f61bc1485c5956ee2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 18 Jun 2019 20:46:12 +0200 Subject: [PATCH] Broadcast client activity time. --- client/TracyProfiler.cpp | 4 +++- common/TracyProtocol.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 763e21d9..5cbc19e9 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1143,10 +1143,12 @@ void Profiler::Worker() if( m_broadcast ) { - auto t = std::chrono::high_resolution_clock::now().time_since_epoch().count(); + const auto t = std::chrono::high_resolution_clock::now().time_since_epoch().count(); if( t - lastBroadcast > 3000000000 ) // 3s { lastBroadcast = t; + const auto ts = std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch() ).count(); + broadcastMsg.activeTime = ts - m_epoch; m_broadcast->Send( 8086, &broadcastMsg, broadcastLen ); } } diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 782450c2..7949aed0 100644 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -85,6 +85,7 @@ struct BroadcastMessage { uint32_t broadcastVersion; uint32_t protocolVersion; + uint32_t activeTime; // in seconds char programName[WelcomeMessageProgramNameSize]; };