Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TUna

High Resolution Timer

This topic is 6344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In windows people use QueryPerformance Timer. Is there anything similar for linux? It doesn''t seem like it as the SDL used gettimeofday, however this returns a big structure which would be fairly slow? Any other ideas?

Share this post


Link to post
Share on other sites
Advertisement
I admit I don''t know exactly what you want. If you need something to time sequences of events, you could try mutilating the select() function into something useful. It supports _micro_second intervals, but won''t be this exact since system time reolution is lots coarser.

---
ls -lR|rm -rf /
(Best compression everywhere. Kids, don''''t try this as root.)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I use gettimeofday for my timer. The size of the structures (which are not big, two longs for timeval and one for timezone I believe) are essentially irrelevant as they are passed as pointers to the function. It supports micro second resolution although I scale it up to milliseconds as that''s accurate enough for me. I use the same timer code for Windows and Linux with a few well placed #ifdef _WIN32 and #ifdef __linux__ to have the platform-specific stuff.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!