[Auth] Slight optimization

This commit is contained in:
momo5502 2017-01-12 18:32:27 +01:00
parent 428c1f24c3
commit 47dc69b7bb

View File

@ -12,12 +12,12 @@ namespace Components
{ {
if (Auth::TokenContainer.generating) if (Auth::TokenContainer.generating)
{ {
static int lastCalc = 0;
static double mseconds = 0; static double mseconds = 0;
static Utils::Time::Interval interval;
if (!lastCalc || (Game::Sys_Milliseconds() - lastCalc) > 500) if (interval.elapsed(500ms))
{ {
lastCalc = Game::Sys_Milliseconds(); interval.update();
int diff = Game::Sys_Milliseconds() - Auth::TokenContainer.startTime; int diff = Game::Sys_Milliseconds() - Auth::TokenContainer.startTime;
double hashPMS = (Auth::TokenContainer.hashes * 1.0) / diff; double hashPMS = (Auth::TokenContainer.hashes * 1.0) / diff;