Skip to main content
GameDev.net gamedev.net
🔒 Locked

Programming a timer??

Started by DarkWhoppy Jan 19, 2004 at 5:26 PM 10 replies 1.6k views
Original Post
DarkWhoppy
DarkWhoppy
I''m having some trouble keeping track of minutes/secs . I tried using the Timer functions NeHe has in Tutorial #21 but that didn''t go to well. Could someone help me out?
Visit the 3DHangout
alnite
alnite
For the sake of completing it.

QueryPerformanceFrequency()
QueryPerformanceCount()
DarkWhoppy
DarkWhoppy
That is a real big help. . . Those functions are in the Win32 libraries aren''t they?
Visit the 3DHangout
Ademan555
Ademan555
Which timer would you guys recomend the most? (save for one made by me in asm cuz i dont know any asm)
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
CROWsoft
CROWsoft
(add "Winmm.lib" to linker)

include "Mmsystem.h"

DWORD dwOldTickcount = timeGetTime();

DWORD dwNewTickcount = timeGetTime();

DWORD dwDifTickcount = (dwNewTickcount - dwOldTickcount) ;

DWORD dwDifsec = (dwDifTickcount / 100);



Hope this is helpful.
-Crow




DarkWhoppy
DarkWhoppy
If the Win32 timer is the best way to go I can use that. But I don't know how to "use" it in programming. (C++) Example?

Whops--Thanks

[edited by - DarkWhoppy on January 19, 2004 8:15:31 PM]
Visit the 3DHangout
Ademan555
Ademan555
well whats your goal? the way that ive attacked timing in general has been simply by making a timer class...which is well...a timer... hard to explain without a real goal...

also: how accurate/how much overhead is involved with timeGetTime ?

[edited by - Ademan555 on January 19, 2004 8:46:39 PM]
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
DarkWhoppy
DarkWhoppy
It''ll be used for a demo. Displaying certian images by how much time has passed. like

if(Time >= 1:00) //Which would probably be in millisecs 60,000
{
Do-Stuff-Here;
}

Ya get me? But if someone could provide an example of using the Win32 timer functions I''d appreciate it.

[center][img]http://home.no.net/archaic/DarkWsign.jpg[/img][/center]
Visit the 3DHangout
Ademan555
Ademan555
ok just use timeGetTime to get the current time, then have a variable that is the last time you did timeGetTime and then subract the past one form the current and voila you have the amount of time passed, from there you have what yo uneed ( hope)
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out hi
Jan Wassenberg
Jan Wassenberg
Ademan555: timeGetTime took about 100 clocks on my old Win2k, Athlon XP system. GetSystemTimeAsFileTime and GetTickCount, which just read memory mapped into your process, take only 6 and 8 clocks. QueryPerformanceCounter goes to the hardware, so its overhead is 0.7 .. 3 µs (depending on implementation).
timeGetTime resolution defaults to 10 ms or 15 ms on SMP HAL systems, and can be set down to 1 ms with timeBeginPeriod.
But that''s all information that can be quickly measured or read about in the dox
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.