mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
'v_Plat_FloatTime' is only initialized during detour init. Using the loggers before will cause a crash. Code now logs 0.0 when v_Plat_FloatTime is nullptr. Showing 0.0 at this stage is correct as the game dll isn't initialized by then.
42 lines
1.4 KiB
C++
42 lines
1.4 KiB
C++
#include "core/stdafx.h"
|
|
#include "tier0/platform_internal.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: gets the process up time in seconds
|
|
// Output : double
|
|
//-----------------------------------------------------------------------------
|
|
double Plat_FloatTime()
|
|
{
|
|
return v_Plat_FloatTime();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: gets the process up time in milliseconds
|
|
// Output : uint64_t
|
|
//-----------------------------------------------------------------------------
|
|
uint64_t Plat_MSTime()
|
|
{
|
|
return v_Plat_MSTime();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: gets the process up time ( !! INTERNAL ONLY !! DO NOT USE !! ).
|
|
// Output : const char*
|
|
//-----------------------------------------------------------------------------
|
|
const char* Plat_GetProcessUpTime()
|
|
{
|
|
static char szBuf[4096];
|
|
sprintf_s(szBuf, sizeof(szBuf), "[%.3f] ", v_Plat_FloatTime ? Plat_FloatTime() : 0.0);
|
|
|
|
return szBuf;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: gets the process up time.
|
|
// Input : *szBuf -
|
|
// nSize -
|
|
//-----------------------------------------------------------------------------
|
|
void Plat_GetProcessUpTime(char* szBuf, size_t nSize)
|
|
{
|
|
sprintf_s(szBuf, nSize, "[%.3f] ", v_Plat_FloatTime ? Plat_FloatTime() : 0.0);
|
|
} |