use global timer in ServerInfo::Update()
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user