Game Development Community

ipad ios 5 and getRealMilliseconds

by Randy Condon · in iTorque 2D · 11/03/2011 (4:13 pm) · 0 replies

I had an issue on my ipad only hardware where onTimer was not getting called.

It worked fine on the simulator. Even the iPad 5.0 simulator.

So in iPhoneTime.mm, in Platform::getRealMilliseconds()

Duration dt = mach_absolute_time() * absolute_to_millis;

always returned the same value on the iPad hardware, but not on the sim.

Looking into it more, mach_absolute_time() returns a unsigned long long and absolute_to_millis is a double

I tried this and it worked.

Uint64 dt = mach_absolute_time() * absolute_to_millis;
U32 durTime = (U32)dt;

I'm sure that is not a great solution, so let me know a better way to fix this. (Or roll it into the next update of the engine, if it is a true engine problem).

(Or if I'm just doing something else wrong)

Thanks