• Advertisement
Sign in to follow this  

Hardware timer issues

This topic is 3643 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

Hi, I know there are a lot of posts about hardware timers but I have not found one that answers my issue. If there is one already present please point me to it and ill read it. The problem I am having is the hardware timer isn’t giving me the values I expect. This is currently the code I am using: void timer::Start(void) { QueryPerformanceCounter(&htStart); } void timer::Stop(void) { QueryPerformanceCounter(&mTimeStop); } double timer::Hardware(void) { QueryPerformanceFrequency(&perf_frequ); hdt = (double)(htStart.QuadPart-mTimeStop.QuadPart)/(double) perf_frequ.QuadPart; return hdt; } I call Start, then Hardware do my process then stop and loop again. I also have a gettime running along side this and the hardware timer values are alot different than the normal time on. e.g. Software = 2.685 Hardware = 0.000474796 Im not quite sure what im doing wrong with the hardware time. Hope you can help Adam

Share this post


Link to post
Share on other sites
Advertisement
silly me i fixed it

i was calling it in the wrong order.

It now goes start, calculate, stop, process, loop back.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement