mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-30 09:26:15 +02:00
use timeval instead of double for time sync
This commit is contained in:
parent
6ea10c77dd
commit
14b5abe5d7
6 changed files with 21 additions and 15 deletions
|
@ -26,6 +26,14 @@ TimeProvider::TimeProvider() : diffToServer_(0)
|
|||
}
|
||||
|
||||
|
||||
void TimeProvider::setDiff(const tv& c2s, const tv& s2c)
|
||||
{
|
||||
tv latency = c2s - s2c;
|
||||
double diff = latency.sec * 1000. + latency.usec / 1000.;
|
||||
setDiffToServer(diff / 2.);
|
||||
}
|
||||
|
||||
|
||||
void TimeProvider::setDiffToServer(double ms)
|
||||
{
|
||||
static int32_t lastTimeSync = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue