High Resolution Timer

Started by
1 comment, last by TUna 23 years, 3 months ago
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?
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.)
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.

This topic is closed to new replies.

Advertisement