timeGetTime scale?

Started by
15 comments, last by SIGMA 22 years, 2 months ago
hello, i was just wondering what the timeGetTime() function returns for its time scale. i.e. - how many timeGetTime() units does it take to make a second? thanks, -jesse
Advertisement
quote:The timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started.

----------------------------www.physicsforums.comwww.opengl.org
Right, so float Time = float(timeGetTime()) * 0.001f is what you''d want for precise time measurements. Or doubles.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Actually you should process time as integer deltas rather than convert it to floating point, to avoid floating point precision errors (it''s also much faster).

In other words, just store all your times as DWORDs.


--
Eric
-- Eric
Okay, if it''s in miliseconds, wouldn''t I divide it by 1,000? Like: DWORD time = timeGetTime()/1000... so if it returned 5000 miliseconds, it''d be 5 seconds? Or am I seriously confused?
-Jesse
You are correct.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
Yes, you are correct, but if you are planning on dealing with game programming and using timeGetTime() to keep track of the internal fps independent scale, you will not want to deal in seconds (you dont want your frame to change every 5 secs, you want it to change every xxx milliseconds).

Maybe I am just tired and talking crap, but hell

Cray
CrayLead Programmer, MTA (http://www.mtavc.com)cray@multitheftauto.com
But dividing numbers is very slow, so you might as well convert to floating-point and multiply (by 0.001, which is 1/1000), which together is probably about the same as an integer divide. But that''s just my opinion.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
just some suggestions you might find helpful or not :

use the milli-seconds unmulitplied and undivided.
divide before you output anything.
btw: use the timeBeginPeriod() to set higher resolution.
default is 5 or more on NT/2000, but 1 is possible on nearly every system.

if you dont need a high resolution, use GetTickCount().
its much faster.

bye,
-- foobar


Edited by - foobar on January 30, 2002 5:03:33 PM
--- foobarWe push more polygons before breakfast than most people do in a day
fooby, what do you mean by resolution?
-Senses
"I want to make a simple MMORPG first" - Fenryl

This topic is closed to new replies.

Advertisement