View Full Version : Animation timing
TB-Rex
10-30-2000, 06:33 AM
This is no real OpneGL problem but I thing it is near enoth to write it on this board.
I know how to time my animation. But there are some questions about the timer functions in C++. Is clock(); the best way to get the acurate time in ms?
I think clock(); returns the time while my EXE is running in ms. Right?
Are there better functions?
How acurate are the timers under Win9x?
Thanks for every replies.
DFrey
10-30-2000, 07:02 AM
In Windows, the message driven timers are extremely inaccurate. I've never used clock() for timing so I don't know how well it behaves under Windows. For maximum accuracy and precision under Windows, use the high performace counter by way of QueryPerformanceCounter(...) and QueryPerformanceFrequency(...).
I've also used GetTickCount() for a fairly accurate timer, but only to millisecond precision.
There is no STANDARD high-resolution timer
in C/C++.
If you're using Windows, QueryPerformanceCounter()
is the way to go.
If you're using BeOS, the microsecond timer
used for kernel scheduling is available as
system_time().
If you're using some UNIX derivative, you
can set up your own high-resolution timer
using setitimer() and later read it with
getitimer().
TB-Rex
10-30-2000, 11:58 PM
Thanks Thanks Thanks Thanks!
Now I've got my floating animation. It had been the **** ****ing clock() function. QueryPerformanceCounter() is much better. And again: Thanks for this tip.
[This message has been edited by TB-Rex (edited 10-31-2000).]
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.