• ### Announcements

#### Archived

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

## Recommended Posts

masonium    118
I just wanted to know whether GetTickCount measures how long the program has been running or how long the thread has been active. I''m using it to time how long my functions take (yes I know a high performance counter would be better), and I want to make sure extra time from other threads running in other programs would be counted. So if GetTickCount measures how long my main program thread is active, I shouldn''t have a problem. If it measures how long the program is running, then I might have to make a pure DOS program and boot my comp with DOS and run it. So which is it? No, HTML is not an OO language.

##### Share on other sites
ATronic    122
It makes no difference. Just do this at thread startup.

  //GLOBALSint threadStartTime=GetTickCount();int threadTimeRunning=0;//Running codeWhile(inThread){ DoThreadStuff(); threadTimeRunning=(GetTickCount()-threadStartTime);}

There, now you can tell how long the thread has been running no matter when GetTickCount starts. This same meathod can be applied to timing anything really.

A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."

##### Share on other sites
GetTickCount() returns the amount of time since the system was started.

##### Share on other sites
masonium    118
By system you mean windows?

No, HTML is not an OO language.

##### Share on other sites
Brannon    122
Yes, GetTickCount() returns the number of milliseconds since Windows was last booted. It has a granularity of 10ms, so if you need something with more resolution, then try QueryPerformanceCounter(), or the multimedia timers (timeBeginTime(), etc).

They will pretty much all return the same ''units'', meaning milliseconds since Windows was started.

-Brannon