Skip to content

Commit

Permalink
switched to util/performancetimer.h to be frequency independent
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Sep 27, 2015
1 parent 4b4953b commit eb6563d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dlgprefshoutcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,6 @@ void DlgPrefShoutcast::slotApply()
m_pConfig->set(ConfigKey(SHOUTCAST_PREF_KEY, "custom_title"), ConfigValue(custom_title->text()));
m_pConfig->set(ConfigKey(SHOUTCAST_PREF_KEY, "metadata_format"), ConfigValue(metadata_format->text()));

//Tell the EngineShoutcast object to update with these values by toggling this control object.
// Tell the EngineShoutcast object to update with these values by toggling this control object.
m_pUpdateShoutcastFromPrefs->set(1.0);
}
8 changes: 4 additions & 4 deletions src/engine/sidechain/enginenetworkstream.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef __WINDOWS__
#include <windows.h>
#include "util/performancetimer.h"
#else
#include <sys/time.h>
#include <unistd.h>
Expand Down Expand Up @@ -202,20 +203,19 @@ qint64 EngineNetworkStream::getNetworkTimeUs() {
} else {
static qint64 oldNow = 0;
static qint64 incCount = 0;
static PerformanceTimer timerSinceInc;
GetSystemTimeAsFileTime(&ft);
qint64 now = ((qint64)ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10;
if(now == oldNow) {
// timer was not incremented since last call (< 15 ms)
// Add time since last function call after last increment
// This reduces the jitter < one call cycle which is sufficient
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
now += li.QuadPart - incCount;
now += timerSinceInc.elapsed() / 1000;
} else {
// timer was incremented
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
incCount = li.QuadPart;
timerSinceInc.start();
oldNow = now;
}
return now;
Expand Down

0 comments on commit eb6563d

Please sign in to comment.