[News] Use interval object

This commit is contained in:
momo5502 2017-02-25 13:13:58 +01:00
parent caef439942
commit ad47c581d1
2 changed files with 3 additions and 4 deletions

View File

@ -8,7 +8,6 @@ namespace Components
std::thread News::Thread;
std::string News::UpdaterArgs;
std::string News::UpdaterHash;
int News::UpdaterRefresh;
bool News::unitTest()
{
@ -60,9 +59,10 @@ namespace Components
std::string localUpdater = Utils::IO::ReadFile("updater.exe");
localUpdater = Utils::Cryptography::SHA1::Compute(localUpdater, true);
if (News::UpdaterHash.empty() || (News::UpdaterRefresh - Game::Sys_Milliseconds() > 900000)) // Check for updater Update every 15 mins max
static Utils::Time::Interval updateInterval;
if (News::UpdaterHash.empty() || updateInterval.elapsed(15min)) // Check for updater Update every 15 mins max
{
News::UpdaterRefresh = Game::Sys_Milliseconds();
updateInterval.update();
std::string data = Utils::Cache::GetFile("/json/updater"); // {"updater.exe":{"SHA1":"*HASH*"}}

View File

@ -21,7 +21,6 @@ namespace Components
private:
static std::string UpdaterArgs;
static std::string UpdaterHash;
static int UpdaterRefresh;
static std::thread Thread;
static bool Terminate;