use global timer in ServerInfo::Update()

This commit is contained in:
Andrzej Rybczak
2010-01-30 14:46:24 +01:00
parent 9e5700cfd0
commit 6b8a644291

View File

@@ -18,6 +18,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#include <sys/time.h>
#include <iomanip> #include <iomanip>
#include "global.h" #include "global.h"
@@ -90,11 +91,10 @@ std::basic_string<my_char_t> ServerInfo::Title()
void ServerInfo::Update() void ServerInfo::Update()
{ {
static time_t now = 0, past; static timeval past = { 0, 0 };
time(&past); if (Global::Timer.tv_sec <= past.tv_sec)
if (past <= now)
return; return;
time(&now); gettimeofday(&past, 0);
Mpd.UpdateStats(); Mpd.UpdateStats();
w->Clear(); w->Clear();