#include "Time.hpp"

TSE::ITimeInterface* TSE::Time::timeInterface = nullptr;
float TSE::Time::DeltaTime = 0;
float TSE::Time::LastFrameTime = 0;
float TSE::Time::CurrentTime = 0;

void TSE::Time::Init(ITimeInterface *time)
{
    Time::timeInterface = time;
}

void TSE::Time::Destroy()
{
    delete(timeInterface);
}

float TSE::Time::deltaTime()
{
    return DeltaTime;
}

float TSE::Time::currentTime()
{
    return CurrentTime;
}

float TSE::Time::lastFrameTime()
{
    return LastFrameTime;
}

void TSE::Time::Update()
{
    LastFrameTime = CurrentTime;
    CurrentTime = timeInterface->GetTotalEllapsedTime();
    DeltaTime = CurrentTime - LastFrameTime;
}
