Hardware timer issues

Started by
0 comments, last by OptimAdam 16 years, 3 months ago
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
Advertisement
silly me i fixed it

i was calling it in the wrong order.

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

This topic is closed to new replies.

Advertisement