[Friends] Use correct duration cast to determine online state
This commit is contained in:
parent
38f5fba090
commit
9bf1934083
@ -305,9 +305,12 @@ namespace Components
|
|||||||
Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::Proxy::SteamUtils->GetServerRealTime()));
|
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()
|
Friends::Friends()
|
||||||
|
@ -72,6 +72,6 @@ namespace Components
|
|||||||
|
|
||||||
static void UpdateTimeStamp();
|
static void UpdateTimeStamp();
|
||||||
|
|
||||||
static bool IsOnline(unsigned int ts);
|
static bool IsOnline(unsigned __int64 timeStamp);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user