|
-
September 26th, 2004, 05:46 AM
#1
Difference of time in MilliSeconds - pls help urgent !!
Hi friends,
I am trying out a small function in which i want a time difference in milliseconds.
but am not able to do it.
i am using time_t tm;
than doing GetLocalTime(&tm); and using another instance but time_t does not show time in milliseconds.
I also tried with CTime and SYSTEMTIME but they give independant values and does not provide substraction facility.
pls help ... how to do this ?
Thanks.
u Want and u get it - That is LUCK,
u want and u wait - That is TIME,
u want dut u compromise - That is LIFE,
But U want, U wait and u Don't compromise, That is SUCCESS.
-
September 26th, 2004, 05:50 AM
#2
Re: Difference of time in MilliSeconds - pls help urgent !!
Aloha,
you could use
clock()
Look in the MSDN, how to use it.
Its really nice.
Greetings
BOA
-
September 26th, 2004, 05:51 AM
#3
Re: Difference of time in MilliSeconds - pls help urgent !!
hi,
try the GetTickCount function.
The difference between start of some code part and end would be the execution time in milliseconds.
regards,
typecast
-
September 27th, 2004, 04:55 AM
#4
Re: Difference of time in MilliSeconds - pls help urgent !!
You should use QueryPerformanceCounter() or QueryPerformanceFrequency() in stead.
If you try to benchmark a function, you dhould do something like this:
Code:
DWORD start, end;
DWORD dwCounter = 10000; // or some other value
QueryPerformanceCounter(&start);
while(dwCounter--)
foo(); // call your function
QueryPerformanceCounter(&end);
double average = (end-start)/10000;
Last edited by cilu; September 27th, 2004 at 05:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|