using time.h seems to want to only give me seconds. Anyone know how to grab the time in miliseconds? Is there anything else that has more presision (sp?)?
using time.h seems to want to only give me seconds. Anyone know how to grab the time in miliseconds? Is there anything else that has more presision (sp?)?
XP VC 6.0
also it's a win32 api program
if winblows has anthing like that.
whatever happened to getting the raw value of the system clock? that sucker was in miliseconds, and a firggin huge number at that.
Why OS btw?
well, lemme tell you my problem, and hopefully you can suggest something.
I want to only preform an operation after 30 miliseconds. I have the theory drawn out where I would get the time, then do a loop and compare that time with the current time. When the difference is > 30 miliseconds exit loop.
Code:variable1 variable2 variable1 = getTimeInMiliseconds; variable2 = getTimeInMiliseconds; while (variabe1 - variable2 > 30) { //loop variable2 = getTimeInMiliseconds; }
if absolute precision is the name of the game GetTickCount may not be the best choice. Let me warn that more precision = moreoverhead, i.e it takes longer for the function to return a value
look into
timeGetTime
and
timeGetSystemTime (this is, i believe, the most accurate and precise)
this gives a good explanation how to increase precision
Last edited by Shadow12345; 12-16-2002 at 07:04 AM.
>Let me warn that more precision = moreoverhead, i.e it takes longer for the function to return a value
Although I'm going to argue about which method is best, but surely the longer it takes for the function to return, the less accurate it's going to be. I.e.
This reminds me of Heisenbergs Uncertainty Principle.Code:// I need the time NOW! DWORD now = timeGetTime(); // But this takes ages to return
No need to argue, if you say you know which ones is best please say so, I was just trying to say the basics and point to a valid resource, but im sure you know which is better DavrosAlthough I'm going to argue about which method is best, but surely the longer it takes for the function to return, the less accurate it's going to be. I.e.
code:--------------------------------------------------------------------------------
// I need the time NOW!
DWORD now = timeGetTime(); // But this takes ages to return
--------------------------------------------------------------------------------
This I'll start a fuss over, time isn't a particle getting moved by the energy transferred from photons of light when they collideThis reminds me of Heisenbergs Uncertainty Principle.
Do you know how to use the timeBeginTime and timeEndTime and query performance functions to increase accuracy? I read over it somewhat but all the information automatically fell out of my head.
>No need to argue, if you say you know which ones is best please say so
I'm not going to argue because I don't know. I'm up for a discussion on this - if you want, but not an argument.
I was just picking up on a point you made. If you say method X is much more accurate than method Y, but method X takes much longer to return, then method X can't be particularly accurate. (Not unless the time it takes to return is known precisely, which would be doubtful.)
>This I'll start a fuss over, time isn't a particle getting moved by the energy transferred from photons of light when they collide
Mmmm. I was simply making an analogy.
Hands up all those who have a degree in Physics.
Now that I think about it that way, that is a good point, however it is true that the more accurate time function takes longer, that is what it says on msdn, so it must be true!I was just picking up on a point you made. If you say method X is much more accurate than method Y, but method X takes much longer to return, then method X can't be particularly accurate. (Not unless the time it takes to return is known precisely, which would be doubtful.)
Maybe we should develop a rule then:
If you need something that needs to calculate time many times (i.e frames per second per game) then use the slightly less accurate method (it hardly matters because in this case it only needs to determine if it is over 1000ms, so a small inaccuracy could only result in incorrectly report only a few frames.
If however, you need something that doesn't need to be calculated many times per second, but needs absolute accuracy and precision, then go for the more accurate and precise methods that generate more overhead. I can't think of something that would require that much precision.
sorry, I'm an assMmmm. I was simply making an analogy.
Hands up all those who have a degree in Physics.
>sorry, I'm an ass
Not true. You almost had me digging through physics text books.
maybe I should be a motivational speaker or somethingNot true. You almost had me digging through physics text books.
Hmm I wonder if we've helped Diamonds @ all lol