nanoTime() or Timer()?

Started by elias4444, January 07, 2005, 20:54:46

Previous topic - Next topic

elias4444

I've been using Java 5 with System.nanoTime()  for my resolution timer. It's come to my attention however that lwjgl has the Timer class. Which is better to use for games? Everything works well with nanoTime, but I'm wondering if Timer would be better (if anything, to backpedal to java 1.4.2 for Mac compatibility).
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

gregorypierce

nanoTime() will be a little bit more consistent once the Java5 move happens on OSX. I'm not a big fan of the Timer class just because its binding to the native code on the mac isn't ideal.

princec

What does it do that you don't like on the Mac? (So we can fix it)

Cas :)

elias4444

I must admit, after going through two of my games and revamping my gameloops to use the lwjgl timer, it does seem a bit smoother. Honestly, I'm not sure why though. I spit out a bunch of debug stuff to the console to check the accuracy, and they both seemed nearly identical.

It was nice though to get everything working under Java 1.4.2. Although I still prefer Java 5. I figure, so long as Sun is dishing out 1.4.2 to the masses, it's easier for the end-user to not have to worry about it.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

gregorypierce

Quote from: "princec"What does it do that you don't like on the Mac? (So we can fix it)

Cas :)

THe resolution of the timer seems to loop (actual resolution too large for what its stored in).

EgonOlsen


princec

Yeah, I'll fix it for the forthcoming 0.95 release.

Cas :)