[Solved] When does a “frame” start and end?

HeatSync Asks: When does a “frame” start and end?
here is the main loop that I currently have (and it does work perfectly):

Code:
// in another header:

...
using i64u = unsigned long long;

...

// mainloop:
i64u lastTime = static_cast<const i64u>(SDL_GetPerformanceCounter());
double accumulator = 0.0;

double t = 0.0;
double dt = 1.0 / 30.0;

SDL_Event e;

while (IsRunning())
{
    bool bRet;

    bRet = SDL_PollEvent(&e) == SDL_TRUE;
    if (bRet)
    {
        if (SDL::ProcessMessages(e))
        {
        }
        else
        {
            IsRunning() = false;
            break;
        }
    }
    else
    {
    }

    bool render = false;

    const i64u now = static_cast<const i64u>(SDL_GetPerformanceCounter());
    const double frameTime = static_cast<const double>((now - lastTime) * 1000) / SDL_GetPerformanceFrequency();

    accumulator += (frameTime / 1000);

    while (accumulator >= dt)
    {
        if (bRet)
        {
            if (this->Game().Get()->InputDevice().Get()->ProcessMessages(e))
            {
            }
            else
            {
            }
        }
        else
        {
        }

        // side-note: should OnUpdate go here?
        // or remain outside of this loop and keep passing "frameTime"?

        t += dt;
        accumulator -= dt;

        render = true;
    }

    this->Game().Get()->OnUpdate(frameTime);

    lastTime = now;

    if (render == true)
    {
    }
    else
    {
    }

    this->Game().Get()->OnDraw();

    SDL::SwapWindow();
}

...
bool& <App>::IsRunning()
{
    return m_Running;
}

const bool <App>::IsRunning() const
{
    return m_Running;
}

My question is: How should (or rather, how does it normally tend to be implemented) a frame be determined? So, for example, should lastTime be set after the OnDraw(), or should it be set before OnDraw() but AFTER the the logic and input has been determined (after OnUpdate())?

What truly constitutes “a frame” -> In my mind, a frame would constitute as “everything being prepared in order to be drawn”, which I think of as “get the input, calculate physics and other game logic data, and then once that “frame” is finished, draw the “frame” – though I’m not really sure how this is (or might) done in the real world.

Is there even “a right or wrong way” when implementing this kind of loop? I would imagine so.

What would y’all recommend?

(also, ignore the trailing if statements. that’s some stuff to help me keep track of what’s going on.)

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.