[Friends] Use correct duration cast to determine online state

This commit is contained in:
momo5502 2017-01-31 15:35:34 +01:00
parent 38f5fba090
commit 9bf1934083
2 changed files with 6 additions and 3 deletions

View File

@ -305,9 +305,12 @@ namespace Components
Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::Proxy::SteamUtils->GetServerRealTime()));
}
bool Friends::IsOnline(unsigned int ts)
bool Friends::IsOnline(unsigned __int64 timeStamp)
{
return (Steam::Proxy::SteamUtils && ((Steam::Proxy::SteamUtils->GetServerRealTime() - ts) <= 5 * 60)); // % minutes
if (!Steam::Proxy::SteamUtils) return false;
static const unsigned __int64 duration = std::chrono::duration_cast<std::chrono::seconds>(5min).count();
return ((Steam::Proxy::SteamUtils->GetServerRealTime() - timeStamp) < duration);
}
Friends::Friends()

View File

@ -72,6 +72,6 @@ namespace Components
static void UpdateTimeStamp();
static bool IsOnline(unsigned int ts);
static bool IsOnline(unsigned __int64 timeStamp);
};
}