Sign in to follow this  
giugio

timer system

Recommended Posts

hello.
i'm searching for an efficent timer system for using it in a opengl graphics application.
There is something already done?or open source?
I'm using c++.
thanks.

Share this post


Link to post
Share on other sites
What features do you look for in a "timer system"?

If you're using a compiler that supports C++11, then take a look at [tt][url=http://en.cppreference.com/w/cpp/chrono/high_resolution_clock]std::chrono::high_resolution_clock[/url][/tt]: High resolution precision, and cross-platform. If your compiler doesn't support C++11, then you might consider using boost's version of [tt]std::chrono[/tt], [tt][url=http://www.boost.org/doc/libs/1_47_0/doc/html/chrono.html]boost::chrono[/url][/tt].

If none of these are viable options, then you'll be stuck writing platform-specific code. In win32, it's [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904%28v=vs.85%29.aspx]QueryPerformanceCounter[/url], QueryPerformanceFrequency, timeGetTime, GetTickCount, and etc. In a POSIX system, it's apparently [url=http://stackoverflow.com/questions/538609/high-resolution-timer-with-c-and-linux]clock_gettime[/url].

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this