Skip to content

minor issue with high_resolution_clock #5

Description

@Francesco149

I see you're falling back to high_resolution_clock on unknown platforms that have c++11, the problem is that high_resolution_clock is not guaranteed to be steady, meaning that it could jump back in time and stuff like that. you can check with high_resolution_clock::is_steady . for example, on my linux system it's not steady. you could check is_steady and fallback to either steady_clock or SDL_GetTicks() .

this is obv a very niche issue as everyone's gonna be on windows/linux

if you want to pick the most accurate clock you can also check chrono timer accuracies by doing something like:

template <class T>
double timerAccuracy() {
    return (double)(T::period::num * 1000) / T::period::den);
}

and it will return the smallest representable value in seconds

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions