One qestion about lwjgl's getTime()

What are you trying to prove? That was just a quick reply to sproingie. Nothing’s not error prone anyway, there’s always an idiot somewhere who will mess up an idiot-proof system.

Also, to prove my first point, you added an extra zero in there :wink:

An int is 32 bits and cannot store 10 billion. Try it.

Right but we’re talking about 1 billion :S

I’m sorry but I think you may miss my question
now I will explain it more:(please read it Thx)
1.I know getTime() will return the time in ticks,for e.g when I call getTime() 1000 times perSecond on a machine which getTimerResolution() will return 1000 , it will return a long which interval is 1;
2.if now there is a machine which getTimerResolution() will return 100, so I call getTime() it’s interval will be 10(= 1000/100)right?
then for e.g when i call getTime() in two continuous ticks will return 6000 and 6010
so now calc them to millisecond(in fact, I don’t understand what millisecond here?)
60001000/100(getTimerResolution())= 60000
6010
1000/100=60100
now I calc the delta time :
60100-60000=100(what is the unit?millisecond?why?I can’t understand!!)
thx for read it for so my ugly English grammer…
wait for your help…

You are inventing numbers and concepts everywhere. getTime() returns the time in ticks, which is a unit that doesn’t exactly mean anything until you get a resolution, which is what getTimerResolution() returns. getTimerResolution() returns how many ticks there are in 1 second. Therefore if getTime() returns 100, and getTimerResolution() returns 100, then 1 second has passed. If getTime() returns 10,000 and getTimerResolution() returns 1000, then 10 seconds have passed. And son on and so forth.

You want to convert that 1 second to millisecond, so we just multiply it by 1000.

Any better?

oh
I must make an large mistake…
but I still can’t understanding what is getTime() return
you say if getTime = 100 and getTimerResolution = 100 then 1 second pass why? how you know ? I can’t understand there are what connect between 100 and 100 …
end why I call getTime return values like these
21555184
21555201
21555217
21555234
and my getTimerResolution() return 1000
it means how many time pass?
sorry for my stupid…

what if you just let this pass and simply use the method which returns milliseconds.
Perhaps when you look back at this in a few weeks you will have your eureka moment.

OK I will just use it now
it’s principle make me really a headache…

Sor I mean that what is time in Ticks? What is Ticks?..

I’m not sure if you’re cut out for this game programming malarkey … :-\

Cas :slight_smile:

hehe sor
I admit I’m so stupid…
but I want to learn :slight_smile:

sighs I think princec is right, you can’t even read :frowning:

Real men write it out in binary.

but what you get about “getTime() returns the time in ticks, which is a unit that doesn’t exactly mean anything until you get a resolution”?
tell me getTime() return a long which that doesn’t mean anything?
but I ask that “you say if getTime = 100 and getTimerResolution = 100 then 1 second pass why?”
100*100=1second? it’s crazy!!!:o

I have sworn to never post in this thread again but here I go …

Look whenever you want to give some number a meaning you have to attach a unit to this number.
Like when I say my hard-drive has 64. You would probably ask 64 what? Then I could tell you 64 GigaByte(GB), so the unit is GB and only because of the unit this number(64) makes any sens for you.

Now back to our little time problem.
We have this function getTime which returns to us the actual time, but in a unit X we do not know(it is not specified and can as written above vary).
So the second function getTimerResolution gives us conversion number to convert a time in the unit X to the equal time amount in seconds.

This is the same principle like when you want to know how much Euro € your 100$ are worth. Somebody might tell you that 1$ == 0.8€ so you can just multiply your 100$ * 0.8(€/$) = 80€

In our problem getTimerResolution tells us how many of X is one second(X/s).
now we get for example after the call to getTime as a result: 10.000
and from getTimerResolution: 100

So we can just do this simple calculation:
10.000X = r seconds * 100(X/s) //r is the time in seconds we want to know
10.000X / 100(X/s) = r seconds
100 (X/X) s = r seconds
100s = r seconds
so the time is 100 seconds.

Now when we do not want the time in seconds but in milliseconds for example we can multiply the result with 1000(I will not explain this again look at my first!!! post).
The thing my one would like to multiply before the unit conversion is because we do integer math.

Measuring time in ticks is much more reasonable as that’s what the actual clock will be returning.

Sorry for my bad English to waste your free times :frowning:
and Thx for your enthusiastic to my stupid
Now I had really know it
good luck

I think you’re the one who needs the luck here :slight_smile: I can’t imagine how you’re going to cope with sprites, collision detection, game loops, user input, etc…

Cas :slight_smile:

Is the role reversal week? I thought I was suppose bad cop.