From ad47c581d15e9f6cef562aebe28503bcbe566b80 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 25 Feb 2017 13:13:58 +0100 Subject: [PATCH] [News] Use interval object --- src/Components/Modules/News.cpp | 6 +++--- src/Components/Modules/News.hpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Components/Modules/News.cpp b/src/Components/Modules/News.cpp index c16b32fc..25280017 100644 --- a/src/Components/Modules/News.cpp +++ b/src/Components/Modules/News.cpp @@ -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*"}} diff --git a/src/Components/Modules/News.hpp b/src/Components/Modules/News.hpp index 36ad52d8..41cb88eb 100644 --- a/src/Components/Modules/News.hpp +++ b/src/Components/Modules/News.hpp @@ -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;