LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: spasi on June 19, 2004, 21:03:55

Title: Laptop timer issue
Post by: spasi on June 19, 2004, 21:03:55
My brother bought a laptop last month and he's seeing some strange timing issues with certain games. The cpu is a Pentium M 1.6GHz, that downclocks to ~550MHz when "just working" in Windows. The problem is that when starting a game, the cpu isn't immediately back up to 1.6GHz. It seems that these certain games, read the hi-res timer resolution at that time (when the cpu frequency is still low) and that results in these games running faster (their animations) than they should (~3 times).

I'm wondering if anyone has encountered such a problem and what they did to solve it (just call getTimerRes every time, "refresh" the resolution every few seconds).

I guess we'll soon see auto-downclocking in desktop cpus soon, so this may become a general issue.

PS: Am I right to assume that the hi-res timer resolution is dependent on the cpu frequency?
Title: Laptop timer issue
Post by: fenix on June 19, 2004, 21:34:08
I encountered this problem only in Ubisoft games (Splinter Cell 2 & Prince of Persia), I load the game and everything is running faster than normal. When I quit the game and reload fast enough everything runs as it should.
Title: Laptop timer issue
Post by: princec on June 19, 2004, 22:35:26
Ahhh. That explains why one one my minions at work always has to play Trials Pro at 2x its normal rate the first time he plays. It's not limited to laptops I don't think.

The correct approach is to periodically refresh the timer resolution.

Cas :)
Title: Laptop timer issue
Post by: oNyx on June 25, 2004, 01:00:38
Mh... how annyoing. But it's good to know that pitfall.
Title: Laptop timer issue
Post by: princec on June 25, 2004, 09:15:28
We should get that documented. I'll probably update the org.lwjgl.util.Timer class too so that it automatically refreshes its resolution every minute.

Cas :)
Title: Laptop timer issue
Post by: spasi on June 25, 2004, 14:21:43
It would be nice if the refresh interval (the 1 minute you mentioned) could be set from the api.
Title: Laptop timer issue
Post by: princec on June 25, 2004, 14:31:11
Nice but probably pointless :) Maybe every 5 seconds is fine. We are, after all, talking about a JNI call that takes 300nanos to execute.

Cas :)