Refactor engine systems to use platform time seconds rather than date time

This commit is contained in:
Wojtek Figat
2024-01-28 22:15:34 +01:00
parent 69b7a10c1f
commit 10bed94357
13 changed files with 41 additions and 41 deletions

View File

@@ -17,7 +17,7 @@ Span<const Char*> Utilities::Private::HertzSizes(HertzSizesData, ARRAY_COUNT(Her
namespace
{
CriticalSection PoolLocker;
DateTime LastUpdate;
double LastUpdate;
float LastUpdateGameTime;
Dictionary<Object*, float> Pool(8192);
uint64 PoolCounter = 0;
@@ -114,7 +114,7 @@ void ObjectsRemovalService::Flush(float dt, float gameDelta)
bool ObjectsRemoval::Init()
{
LastUpdate = DateTime::NowUTC();
LastUpdate = Platform::GetTimeSeconds();
LastUpdateGameTime = 0;
return false;
}
@@ -124,8 +124,8 @@ void ObjectsRemoval::LateUpdate()
PROFILE_CPU();
// Delete all objects
const auto now = DateTime::NowUTC();
const float dt = (now - LastUpdate).GetTotalSeconds();
const double now = Platform::GetTimeSeconds();
const float dt = (float)(now - LastUpdate);
float gameDelta = Time::Update.DeltaTime.GetTotalSeconds();
if (Time::GetGamePaused())
gameDelta = 0;