mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-01 03:07:33 +02:00
29 lines
363 B
C++
29 lines
363 B
C++
#include "timeProvider.h"
|
|
|
|
|
|
TimeProvider::TimeProvider() : diffToServer(0)
|
|
{
|
|
diffBuffer.setSize(60);
|
|
}
|
|
|
|
|
|
void TimeProvider::setDiffToServer(double ms)
|
|
{
|
|
diffBuffer.add(ms * 1000);
|
|
diffToServer = diffBuffer.median();
|
|
}
|
|
|
|
|
|
long TimeProvider::getDiffToServer()
|
|
{
|
|
return diffToServer;
|
|
}
|
|
|
|
|
|
long TimeProvider::getDiffToServerMs()
|
|
{
|
|
return diffToServer / 1000;
|
|
}
|
|
|
|
|
|
|