[News] Use interval object
This commit is contained in:
parent
caef439942
commit
ad47c581d1
@ -8,7 +8,6 @@ namespace Components
|
|||||||
std::thread News::Thread;
|
std::thread News::Thread;
|
||||||
std::string News::UpdaterArgs;
|
std::string News::UpdaterArgs;
|
||||||
std::string News::UpdaterHash;
|
std::string News::UpdaterHash;
|
||||||
int News::UpdaterRefresh;
|
|
||||||
|
|
||||||
bool News::unitTest()
|
bool News::unitTest()
|
||||||
{
|
{
|
||||||
@ -60,9 +59,10 @@ namespace Components
|
|||||||
std::string localUpdater = Utils::IO::ReadFile("updater.exe");
|
std::string localUpdater = Utils::IO::ReadFile("updater.exe");
|
||||||
localUpdater = Utils::Cryptography::SHA1::Compute(localUpdater, true);
|
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*"}}
|
std::string data = Utils::Cache::GetFile("/json/updater"); // {"updater.exe":{"SHA1":"*HASH*"}}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ namespace Components
|
|||||||
private:
|
private:
|
||||||
static std::string UpdaterArgs;
|
static std::string UpdaterArgs;
|
||||||
static std::string UpdaterHash;
|
static std::string UpdaterHash;
|
||||||
static int UpdaterRefresh;
|
|
||||||
static std::thread Thread;
|
static std::thread Thread;
|
||||||
|
|
||||||
static bool Terminate;
|
static bool Terminate;
|
||||||
|
Loading…
Reference in New Issue
Block a user