#include "delta_handler.hpp"


DeltaHandler::DeltaHandler()
: start{std::chrono::steady_clock::now()}, currentTime{start}, previousTime{start}
{}

void DeltaHandler::restart()
{
    start = std::chrono::steady_clock::now();
    currentTime = start;
    previousTime = start;
}

void DeltaHandler::updateDelta()
{
    previousTime = currentTime;
    currentTime = std::chrono::steady_clock::now();
}

double DeltaHandler::getDelta() const
{
    return std::chrono::duration<double>(currentTime - previousTime).count();
}

double DeltaHandler::getTimeSinceRestart() const
{
    return std::chrono::duration<double>(currentTime - start).count();
}