Archived

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

OGAPO

high rez timer?

Recommended Posts

OGAPO    122
Hey I'm having some trouble with a timing mechanism i have implemented. I'm using time.h's clock() function to read the time elapsed to the milisecond, but apparently it's not very precise. I started counting the dropped frames (when (now -last_time) == 0 b/c I am using this value to multiply against velocities if it's zero there's no change) and at about 50FPS it was dropping 48% of the frames. You would think that the difference shouldn't be zero unless you're running more than 1000 FPS (at which ppoint I wouldn't mind a few dropped frames ) but at 50 FPS? it must be rounding or something (to nearest 50?) anyways, back to my origeonal question, does anyone know how I can get access to a better timer (more precise)? I know the max I'm looking for something around 10 kHz to accomodate the faster processors (and any rounding), is this available? Thanks for any help, O.G.A.P.O. Edited by - OGAPO on 10/30/00 4:27:18 PM

Share this post


Link to post
Share on other sites
NeoGL    122
you want the performance timer.It counts in terms of CPU cycles, pretty neat , huh!
QueryPerformanceFrequency((LARGE_INTEGER *) &m_Frequency) to see if you have the perf timer available, if not, your frequency would be NULL, calculate your resolutions and all those stuffs and whenever you need to get time, use
QueryPerformanceCounter((LARGE_INTEGER *) &time) and multiply time with the resolution to get it in seconds.
this is the best and most accurate timer available so far.

NeoGL

Share this post


Link to post
Share on other sites
OGAPO    122
dude, that''s awesom, perfect! Exactly what I was looking for! Thanks a lot man

Brought to you by: O.G.A.P.O.
+----------------------------------------+
| Surgeon General's Warning - |
| OGAPO can cause serious mental damage |
| if taken in large doses. |
+----------------------------------------+

/* Never underestimate the power of stupid people in large groups */

Share this post


Link to post
Share on other sites