Send signed active time in broadcast message.

This allows special treatment of negative values.
This commit is contained in:
Bartosz Taudul 2020-09-20 22:15:10 +02:00
parent f9c1b63a3b
commit 5c826c2723
3 changed files with 5 additions and 4 deletions

View File

@ -1390,7 +1390,8 @@ void Profiler::Worker()
{
lastBroadcast = t;
const auto ts = std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count();
broadcastMsg.activeTime = uint32_t( ts - m_epoch );
broadcastMsg.activeTime = int32_t( ts - m_epoch );
assert( broadcastMsg.activeTime >= 0 );
m_broadcast->Send( broadcastPort, &broadcastMsg, broadcastLen );
}
}

View File

@ -10,7 +10,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 40 };
enum : uint32_t { BroadcastVersion = 1 };
enum : uint32_t { BroadcastVersion = 2 };
using lz4sz_t = uint32_t;
@ -111,7 +111,7 @@ struct BroadcastMessage
uint32_t broadcastVersion;
uint32_t protocolVersion;
uint32_t listenPort;
uint32_t activeTime; // in seconds
int32_t activeTime; // in seconds
char programName[WelcomeMessageProgramNameSize];
};

View File

@ -106,7 +106,7 @@ struct ClientData
{
int64_t time;
uint32_t protocolVersion;
uint32_t activeTime;
int32_t activeTime;
uint32_t port;
std::string procName;
std::string address;