mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-26 22:47:07 +02:00
timesync
git-svn-id: svn://elaine/murooma/trunk@258 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
6d6272d23a
commit
a16aa82deb
4 changed files with 50 additions and 28 deletions
|
@ -10,15 +10,15 @@ ControlServer::ControlServer(unsigned short port) : port_(port), headerChunk(NUL
|
|||
|
||||
void ControlServer::onMessageReceived(SocketConnection* connection, const BaseMessage& baseMessage, char* buffer)
|
||||
{
|
||||
cout << "onMessageReceived: " << baseMessage.type << ", size: " << baseMessage.size << ", sent: " << baseMessage.sent.sec << "," << baseMessage.sent.usec << ", recv: " << baseMessage.received.sec << "," << baseMessage.received.usec << "\n";
|
||||
// cout << "onMessageReceived: " << baseMessage.type << ", size: " << baseMessage.size << ", sent: " << baseMessage.sent.sec << "," << baseMessage.sent.usec << ", recv: " << baseMessage.received.sec << "," << baseMessage.received.usec << "\n";
|
||||
if (baseMessage.type == message_type::timemsg)
|
||||
{
|
||||
TimeMsg* timeMsg = new TimeMsg();
|
||||
timeMsg->deserialize(baseMessage, buffer);
|
||||
timeMsg->latency = (timeMsg->received.sec - timeMsg->sent.sec) * 1000000 + (timeMsg->received.usec - timeMsg->sent.usec);
|
||||
cout << "Latency: " << timeMsg->latency << "\n";
|
||||
timeMsg->refersTo = timeMsg->id;
|
||||
connection->send(timeMsg);
|
||||
TimeMsg timeMsg;
|
||||
timeMsg.deserialize(baseMessage, buffer);
|
||||
timeMsg.latency = (timeMsg.received.sec - timeMsg.sent.sec) * 1000000 + (timeMsg.received.usec - timeMsg.sent.usec);
|
||||
// cout << "Latency: " << timeMsg.latency << "\n";
|
||||
timeMsg.refersTo = timeMsg.id;
|
||||
connection->send(&timeMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue