can anyone help me converting milliseconds to seconds ? how do i do that ?

Posted on 2001-11-13 01:56:16 by Unregistered-
Well, it is late, but I believe there are 1000 milliseconds in a second. So if you want to sleep for .5 seconds, move the decimil place two to the right (500). Also, I was told that if you Sleep(0) it surrenders the rest of the threads processing time. I usually use this when my app is minimized and it has no messages. Good luck with your program. :grin:
Posted on 2001-11-13 02:21:30 by AlexEiffel
Divide by 1000 :)
Posted on 2001-11-13 08:11:34 by latigo

;assumes eax contains nr of miliseconds
mov ecx, 1000
xor edx, edx
div ecx
;eax is nr of seconds now

Posted on 2001-11-13 11:07:15 by Thomas

A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay.

- that was what the platformSdk has to say.

I usually use this when my app is minimized and it has no messages. Good luck with your program.

Hm, are you using a PeekMessage approach? If you are, and you
don't need to (ie, you don't need idle processing etc), it's probably
better to use GetMessage, as it should block your thread until
there's a message for it. I think :).
Posted on 2001-11-13 11:19:49 by f0dder
Hey f0dder, I actually need to use PeekMessage because most of my programming is game related. This is the loop I use, is the Sleep unneccessary?

.WHILE msg.message != WM_QUIT

;// Get the Frames Per Second
invoke GetFPS

.IF bActive != FALSE
invoke PeekMessage, ADDR msg, NULL, 0, 0,\ PM_REMOVE
invoke GetMessage, ADDR msg, NULL, 0, 0

.IF eax != FALSE

;// Way to go accelerators
invoke TranslateAccelerator, hwnd, hAccel, ADDR msg

;// Message processing
.if eax == 0
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg

.else ;// There is no message

;// Check if we are active. If not, surrender the apps time slice
.IF bActive == FALSE
invoke Sleep, 0

;// If we are ready, flip the backbuffer to render
.if bReady == TRUE



Thanks for helping out.
Posted on 2001-11-14 01:34:15 by AlexEiffel
It's probably not *necessary*, but it might help the responsiveness
of the system. Then again, you only Sleep(0) if you're not active...
and if you're not active, you use GetMessage, which blocks until
your app gets a message. Hm. I suppose it's unnecessary, but you
never know with windows ;). Try looking at CPU usage when your
program is in inactivate state, both with and without the Sleep(0).
Probably you won't even be able to see a difference :).
Posted on 2001-11-14 07:35:05 by f0dder