Click to See Complete Forum and Search --> : WaitForSingleObject() -- how long ?
wxuf
April 19th, 2004, 02:04 AM
hi..
when an event i am waiting is signaled, the WaitForSingleObject() succeeds. but can i know how long the time is elapsed from the waiting begins ?
wxuf
j0nas
April 19th, 2004, 03:09 AM
No, I don't think that's possible. You have to take the time right before you enter the Wait-function. Something like this:
time(&beforeWait);
WaitForSingleObject(...)
time(&afterWait);
Now you can calculate the time spent in Wait-function by doing afterWait - beforeWait.
BorisKK
April 28th, 2004, 08:38 AM
You may prefer to use GetTickCount() if you need a resolution better than 1 second.
ovidiucucu
April 28th, 2004, 10:59 AM
Originally posted by BorisKK
You may prefer to use GetTickCount() if you need a resolution better than 1 second.
Or, even better than better :) use high-resolution performance counter.
See QueryPerformanceCounter and QueryPerformanceFrequency.
wxuf
April 29th, 2004, 04:33 AM
Thank you all..
Now I use GetTickCount() to get the interval.
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.